O'Reilly logo

PHPUnit Pocket Guide by Sebastian Bergmann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required