class PHPUnit_Extensions_GroupTestSuite extends PHPUnit_Framework_TestSuite (View source)

We have a TestSuite object A.

In TestSuite object A we have Tests tagged with @group. We want a TestSuite object B that contains TestSuite objects C, D, ... for the Tests tagged with @group C, @group D, ... Running the Tests from TestSuite object B results in Tests tagged with both

Properties

protected bool $backupGlobals Enable or disable the backup and restoration of the $GLOBALS array. from PHPUnit_Framework_TestSuite
protected bool $backupStaticAttributes Enable or disable the backup and restoration of static attributes. from PHPUnit_Framework_TestSuite
protected bool $runTestInSeparateProcess from PHPUnit_Framework_TestSuite
protected string $name The name of the test suite. from PHPUnit_Framework_TestSuite
protected array $groups The test groups of the test suite. from PHPUnit_Framework_TestSuite
protected array $tests The tests in the test suite. from PHPUnit_Framework_TestSuite
protected int $numTests The number of tests in the test suite. from PHPUnit_Framework_TestSuite
protected bool $testCase from PHPUnit_Framework_TestSuite
protected array $foundClasses from PHPUnit_Framework_TestSuite

Methods

__construct(PHPUnit_Framework_TestSuite $suite, array $groups)

Constructs a new TestSuite:

string
toString()

Returns a string representation of the test suite.

addTest(PHPUnit_Framework_Test $test, array $groups = [])

Adds a test to the suite.

addTestSuite(mixed $testClass)

Adds the tests from the given class to the suite.

addTestFile(string $filename)

Wraps both addTest() and addTestSuite as well as the separate import statements for the user's convenience.

addTestFiles(array|Iterator $filenames)

Wrapper for addTestFile() that adds multiple test files.

int
count(bool $preferCache = false)

Counts the number of test cases that will be run by this test.

createTest(ReflectionClass $theClass, string $name)

No description

createResult()

Creates a default TestResult object.

string
getName()

Returns the name of the suite.

array
getGroups()

Returns the test groups of the suite.

setGroupDetails(array $groups)

Set tests groups of the test case

run(PHPUnit_Framework_TestResult $result = null)

Runs the tests and collects their result in a TestResult.

setRunTestInSeparateProcess(bool $runTestInSeparateProcess)

No description

setName(string $name)

Sets the name of the suite.

testAt(int|false $index)

Returns the test at the given index.

array
tests()

Returns the tests as an enumeration.

setTests(array $tests)

Set tests of the test suite

markTestSuiteSkipped(string $message = '')

Mark the test suite as skipped.

static bool
isTestMethod(ReflectionMethod $method)

No description

warning(string $message)

No description

skipTest(string $class, string $methodName, string $message)

No description

incompleteTest(string $class, string $methodName, string $message)

No description

setbeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState)

No description

setBackupGlobals(bool $backupGlobals)

No description

setBackupStaticAttributes(bool $backupStaticAttributes)

No description

getIterator()

Returns an iterator for this test suite.

setUp()

Template Method that is called before the tests of this test suite are run.

tearDown()

Template Method that is called after the tests of this test suite have finished running.

Details

__construct(PHPUnit_Framework_TestSuite $suite, array $groups)

Constructs a new TestSuite:

  • PHPUnit_Framework_TestSuite() constructs an empty TestSuite.

    • PHPUnit_Framework_TestSuite(ReflectionClass) constructs a TestSuite from the given class.

    • PHPUnit_Framework_TestSuite(ReflectionClass, String) constructs a TestSuite from the given class with the given name.

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

Parameters

PHPUnit_Framework_TestSuite $suite
array $groups

Exceptions

PHPUnit_Framework_Exception

string toString()

Returns a string representation of the test suite.

Return Value

string

addTest(PHPUnit_Framework_Test $test, array $groups = [])

Adds a test to the suite.

Parameters

PHPUnit_Framework_Test $test
array $groups

addTestSuite(mixed $testClass)

Adds the tests from the given class to the suite.

Parameters

mixed $testClass

Exceptions

PHPUnit_Framework_Exception

addTestFile(string $filename)

Wraps both addTest() and addTestSuite as well as the separate import statements for the user's convenience.

If the named file cannot be read or there are no new tests that can be added, a PHPUnit_Framework_WarningTestCase will be created instead, leaving the current test run untouched.

Parameters

string $filename

Exceptions

PHPUnit_Framework_Exception

addTestFiles(array|Iterator $filenames)

Wrapper for addTestFile() that adds multiple test files.

Parameters

array|Iterator $filenames

Exceptions

PHPUnit_Framework_Exception

int count(bool $preferCache = false)

Counts the number of test cases that will be run by this test.

Parameters

bool $preferCache Indicates if cache is preferred.

Return Value

int

static PHPUnit_Framework_Test createTest(ReflectionClass $theClass, string $name)

Parameters

ReflectionClass $theClass
string $name

Return Value

PHPUnit_Framework_Test

Exceptions

PHPUnit_Framework_Exception

protected PHPUnit_Framework_TestResult createResult()

Creates a default TestResult object.

string getName()

Returns the name of the suite.

Return Value

string

array getGroups()

Returns the test groups of the suite.

Return Value

array

getGroupDetails()

setGroupDetails(array $groups)

Set tests groups of the test case

Parameters

array $groups

PHPUnit_Framework_TestResult run(PHPUnit_Framework_TestResult $result = null)

Runs the tests and collects their result in a TestResult.

setRunTestInSeparateProcess(bool $runTestInSeparateProcess)

Parameters

bool $runTestInSeparateProcess

Exceptions

PHPUnit_Framework_Exception

runTest(PHPUnit_Framework_Test $test, PHPUnit_Framework_TestResult $result) deprecated

deprecated

Runs a test.

setName(string $name)

Sets the name of the suite.

Parameters

string $name

PHPUnit_Framework_Test testAt(int|false $index)

Returns the test at the given index.

Parameters

int|false $index

Return Value

PHPUnit_Framework_Test

array tests()

Returns the tests as an enumeration.

Return Value

array

setTests(array $tests)

Set tests of the test suite

Parameters

array $tests

markTestSuiteSkipped(string $message = '')

Mark the test suite as skipped.

Parameters

string $message

Exceptions

PHPUnit_Framework_SkippedTestSuiteError

protected addTestMethod(ReflectionClass $class, ReflectionMethod $method)

Parameters

ReflectionClass $class
ReflectionMethod $method

static bool isTestMethod(ReflectionMethod $method)

Parameters

ReflectionMethod $method

Return Value

bool

static protected PHPUnit_Framework_WarningTestCase warning(string $message)

Parameters

string $message

Return Value

PHPUnit_Framework_WarningTestCase

static protected PHPUnit_Framework_SkippedTestCase skipTest(string $class, string $methodName, string $message)

Parameters

string $class
string $methodName
string $message

Return Value

PHPUnit_Framework_SkippedTestCase

static protected PHPUnit_Framework_IncompleteTestCase incompleteTest(string $class, string $methodName, string $message)

Parameters

string $class
string $methodName
string $message

Return Value

PHPUnit_Framework_IncompleteTestCase

setbeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState)

Parameters

bool $beStrictAboutChangesToGlobalState

setBackupGlobals(bool $backupGlobals)

Parameters

bool $backupGlobals

setBackupStaticAttributes(bool $backupStaticAttributes)

Parameters

bool $backupStaticAttributes

RecursiveIteratorIterator getIterator()

Returns an iterator for this test suite.

protected setUp()

Template Method that is called before the tests of this test suite are run.

protected tearDown()

Template Method that is called after the tests of this test suite have finished running.