PHPUnit2
[ class tree: PHPUnit2 ] [ index: PHPUnit2 ] [ all elements ]

Class: PHPUnit2_Framework_TestSuite

Source Location: /PHPUnit2-2.0.3/Framework/TestSuite.php

Class Overview


A TestSuite is a composite of Tests. It runs a collection of test cases.


Author(s):

Copyright:

  • Copyright &copy; 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 57]
A TestSuite is a composite of Tests. It runs a collection of test cases.

Here is an example using the dynamic test definition.

  1.  <?php
  2.  $suite = new PHPUnit2_Framework_TestSuite;
  3.  $suite->addTest(new MathTest('testPass'));
  4.  ?>

Alternatively, a TestSuite can extract the tests to be run automatically. To do so you pass a ReflectionClass instance for your PHPUnit2_Framework_TestCase class to the PHPUnit2_Framework_TestSuite constructor.

  1.  <?php
  2.  $suite = new PHPUnit2_Framework_TestSuite(
  3.    new ReflectionClass('MathTest')
  4.  );
  5.  ?>

This constructor creates a suite with all the methods starting with "test" that take no arguments.



[ Top ]


Method Detail

__construct (Constructor)   [line 100]

PHPUnit2_Framework_TestSuite __construct( [mixed $theClass = ''], [string $name = ''])

Constructs a new TestSuite:

  • PHPUnit2_Framework_TestSuite() constructs an empty TestSuite.
  • PHPUnit2_Framework_TestSuite(ReflectionClass) constructs a TestSuite from the given class.
  • PHPUnit2_Framework_TestSuite(ReflectionClass, String) constructs a TestSuite from the given class with the given name.
  • PHPUnit2_Framework_TestSuite(String) either constructs a TestSuite from the given class (if the passed string is the name of an existing class) or constructs an empty TestSuite with the given name.

  • Access: public

Parameters:

mixed   $theClass   — 
string   $name   — 

[ Top ]

addTest   [line 176]

void addTest( PHPUnit2_Framework_Test $test)

Adds a test to the suite.
  • Access: public

Parameters:

PHPUnit2_Framework_Test   $test   — 

[ Top ]

addTestSuite   [line 189]

void addTestSuite( mixed $testClass)

Adds the tests from the given class to the suite.
  • Access: public

Parameters:

mixed   $testClass   — 

[ Top ]

countTestCases   [line 210]

integer countTestCases( )

Counts the number of test cases that will be run by this test.
  • Access: public

[ Top ]

createResult   [line 257]

PHPUnit2_Framework_TestResult createResult( )

Creates a default TestResult object.
  • Access: protected

[ Top ]

createTest   [line 230]

PHPUnit2_Framework_Test createTest( ReflectionClass $theClass, string $name)

  • Access: public

Parameters:

ReflectionClass   $theClass   — 
string   $name   — 

[ Top ]

getName   [line 270]

string getName( )

Returns the name of the suite.
  • Access: public

[ Top ]

run   [line 284]

PHPUnit2_Framework_TestResult run( [PHPUnit2_Framework_TestResult $result = null])

Runs the tests and collects their result in a TestResult.
  • Access: public

Parameters:

PHPUnit2_Framework_TestResult   $result   — 

[ Top ]

runTest   [line 317]

void runTest( PHPUnit2_Framework_Test $test, PHPUnit2_Framework_TestResult $result, PHPUnit2_Framework_TestResult $testResult)

Runs a test.
  • Access: public

Parameters:

PHPUnit2_Framework_Test   $test   — 
PHPUnit2_Framework_TestResult   $testResult   — 
PHPUnit2_Framework_TestResult   $result   — 

[ Top ]

setName   [line 330]

void setName( string $name)

Sets the name of the suite.
  • Access: public

Parameters:

string   $name   — 

[ Top ]

testAt   [line 344]

PHPUnit2_Framework_Test testAt( integer $index)

Returns the test at the given index.
  • Access: public

Parameters:

integer   $index   — 

[ Top ]

testCount   [line 361]

integer testCount( )

Returns the number of tests in this suite.
  • Access: public

[ Top ]

tests   [line 374]

array tests( )

Returns the tests as an enumeration.
  • Access: public

[ Top ]

toString   [line 163]

string toString( )

Returns a string representation of the test suite.
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:55:59 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.