PHPUnit2_Framework_TestSuite

A PHPUnit2_Framework_TestSuite is a composite of PHPUnit2_ Framework_Tests. At its simplest, it contains a group of test cases, all of which are run when the suite is run. Since it is a composite, however, a suite can contain suites that can contain suites and so on, making it easy to combine tests from various sources and run them together.

PHPUnit2_Framework_TestSuite contains protocols to create named or unnamed instances, as well as the PHPUnit2_ Framework_Test protocols, run(PHPUnit2_Framework_TestResult $result) and countTestCases( ). Table 11 shows the instance creation protocol for PHPUnit2_Framework_TestSuite.

Table 11. Creating named or unnamed instances

Method

Description

__construct( )

Returns an empty test suite.

__construct(String $theClass)

Returns a test suite containing an instance of the class named $theClass for each method in the class named test*. If no class of name $theClass exists, an empty test suite named $theClass is returned.

__construct(String $theClass, String $name)

Returns a test suite named $name containing an instance of the class named $theClass for each method in the class named test*.

__construct(ReflectionClass $theClass)

Returns a test suite containing an instance of the class represented by $theClass for each method in the class named test*.

__construct(ReflectionClass $theClass, $name)

Returns a test suite named $name containing an instance of the class represented by $theClass for each method ...

Get PHPUnit Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.