Skip to Main Content
PHPUnit Pocket Guide
book

PHPUnit Pocket Guide

by Sebastian Bergmann
September 2005
Intermediate to advanced content levelIntermediate to advanced
90 pages
1h 53m
English
O'Reilly Media, Inc.
Content preview from PHPUnit Pocket Guide

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

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering PHP 7

Mastering PHP 7

Branko Ajzele

Publisher Resources

ISBN: 0596101031Errata Page