Documentation

PHPUnit_Extensions_GroupTestSuite extends PHPUnit_Framework_TestSuite
in package

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

Tags
group

C and @group D in TestSuite object A to be run twice .

$suite = new PHPUnit_Extensions_GroupTestSuite($A, array('C', 'D'));
since

Class available since Release 3.3.0

Table of Contents

$backupGlobals  : bool
Enable or disable the backup and restoration of the $GLOBALS array.
$backupStaticAttributes  : bool
Enable or disable the backup and restoration of static attributes.
$foundClasses  : array<string|int, mixed>
$groups  : array<string|int, mixed>
The test groups of the test suite.
$name  : string
The name of the test suite.
$numTests  : int
The number of tests in the test suite.
$runTestInSeparateProcess  : bool
$testCase  : bool
$tests  : array<string|int, mixed>
The tests in the test suite.
$cachedNumTests  : int|null
Last count of tests in this suite.
$disallowChangesToGlobalState  : bool
$iteratorFilter  : PHPUnit_Runner_Filter_Factory
__construct()  : mixed
Constructs a new TestSuite:
addTest()  : mixed
Adds a test to the suite.
addTestFile()  : mixed
Wraps both <code>addTest()</code> and <code>addTestSuite</code> as well as the separate import statements for the user's convenience.
addTestFiles()  : mixed
Wrapper for addTestFile() that adds multiple test files.
addTestSuite()  : mixed
Adds the tests from the given class to the suite.
count()  : int
Counts the number of test cases that will be run by this test.
createTest()  : PHPUnit_Framework_Test
getGroupDetails()  : mixed
getGroups()  : array<string|int, mixed>
Returns the test groups of the suite.
getIterator()  : RecursiveIteratorIterator
Returns an iterator for this test suite.
getName()  : string
Returns the name of the suite.
injectFilter()  : mixed
isTestMethod()  : bool
markTestSuiteSkipped()  : mixed
Mark the test suite as skipped.
run()  : PHPUnit_Framework_TestResult
Runs the tests and collects their result in a TestResult.
runTest()  : mixed
Runs a test.
setBackupGlobals()  : mixed
setBackupStaticAttributes()  : mixed
setDisallowChangesToGlobalState()  : mixed
setGroupDetails()  : mixed
Set tests groups of the test case
setName()  : mixed
Sets the name of the suite.
setRunTestInSeparateProcess()  : mixed
setTests()  : mixed
Set tests of the test suite
testAt()  : PHPUnit_Framework_Test
Returns the test at the given index.
tests()  : array<string|int, mixed>
Returns the tests as an enumeration.
toString()  : string
Returns a string representation of the test suite.
addTestMethod()  : mixed
createResult()  : PHPUnit_Framework_TestResult
Creates a default TestResult object.
incompleteTest()  : PHPUnit_Framework_IncompleteTestCase
setUp()  : mixed
Template Method that is called before the tests of this test suite are run.
skipTest()  : PHPUnit_Framework_SkippedTestCase
tearDown()  : mixed
Template Method that is called after the tests of this test suite have finished running.
warning()  : PHPUnit_Framework_Warning

Properties

$backupGlobals

Enable or disable the backup and restoration of the $GLOBALS array.

protected bool $backupGlobals = ull

$backupStaticAttributes

Enable or disable the backup and restoration of static attributes.

protected bool $backupStaticAttributes = ull

$foundClasses

protected array<string|int, mixed> $foundClasses = array()

$groups

The test groups of the test suite.

protected array<string|int, mixed> $groups = array()

$name

The name of the test suite.

protected string $name = ''

$numTests

The number of tests in the test suite.

protected int $numTests = -1

$runTestInSeparateProcess

protected bool $runTestInSeparateProcess = alse

$tests

The tests in the test suite.

protected array<string|int, mixed> $tests = array()

$cachedNumTests

Last count of tests in this suite.

private int|null $cachedNumTests

$disallowChangesToGlobalState

private bool $disallowChangesToGlobalState = ull

Methods

__construct()

Constructs a new TestSuite:

public __construct(PHPUnit_Framework_TestSuite $suite, array<string|int, mixed> $groups) : mixed
  • 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
$suite : PHPUnit_Framework_TestSuite
$groups : array<string|int, mixed>
Return values
mixed

addTestFile()

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

public addTestFile(string $filename) : mixed

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

Parameters
$filename : string
Tags
throws
PHPUnit_Framework_Exception
since

Method available since Release 2.3.0

Return values
mixed

addTestFiles()

Wrapper for addTestFile() that adds multiple test files.

public addTestFiles(array<string|int, mixed>|Iterator $filenames) : mixed
Parameters
$filenames : array<string|int, mixed>|Iterator
Tags
throws
PHPUnit_Framework_Exception
since

Method available since Release 2.3.0

Return values
mixed

addTestSuite()

Adds the tests from the given class to the suite.

public addTestSuite(mixed $testClass) : mixed
Parameters
$testClass : mixed
Tags
throws
PHPUnit_Framework_Exception
Return values
mixed

count()

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

public count([bool $preferCache = false ]) : int
Parameters
$preferCache : bool = false

Indicates if cache is preferred.

Return values
int

getGroupDetails()

public getGroupDetails() : mixed
Return values
mixed

getGroups()

Returns the test groups of the suite.

public getGroups() : array<string|int, mixed>
Tags
since

Method available since Release 3.2.0

Return values
array<string|int, mixed>

getIterator()

Returns an iterator for this test suite.

public getIterator() : RecursiveIteratorIterator
Tags
since

Method available since Release 3.1.0

Return values
RecursiveIteratorIterator

getName()

Returns the name of the suite.

public getName() : string
Return values
string

isTestMethod()

public static isTestMethod(ReflectionMethod $method) : bool
Parameters
$method : ReflectionMethod
Return values
bool

markTestSuiteSkipped()

Mark the test suite as skipped.

public markTestSuiteSkipped([string $message = '' ]) : mixed
Parameters
$message : string = ''
Tags
throws
PHPUnit_Framework_SkippedTestSuiteError
since

Method available since Release 3.0.0

Return values
mixed

setBackupGlobals()

public setBackupGlobals(bool $backupGlobals) : mixed
Parameters
$backupGlobals : bool
Tags
since

Method available since Release 3.3.0

Return values
mixed

setBackupStaticAttributes()

public setBackupStaticAttributes(bool $backupStaticAttributes) : mixed
Parameters
$backupStaticAttributes : bool
Tags
since

Method available since Release 3.4.0

Return values
mixed

setDisallowChangesToGlobalState()

public setDisallowChangesToGlobalState(bool $disallowChangesToGlobalState) : mixed
Parameters
$disallowChangesToGlobalState : bool
Tags
since

Method available since Release 4.6.0

Return values
mixed

setGroupDetails()

Set tests groups of the test case

public setGroupDetails(array<string|int, mixed> $groups) : mixed
Parameters
$groups : array<string|int, mixed>
Tags
since

Method available since Release 4.0.0

Return values
mixed

setName()

Sets the name of the suite.

public setName(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

setRunTestInSeparateProcess()

public setRunTestInSeparateProcess(bool $runTestInSeparateProcess) : mixed
Parameters
$runTestInSeparateProcess : bool
Tags
throws
PHPUnit_Framework_Exception
since

Method available since Release 3.7.0

Return values
mixed

setTests()

Set tests of the test suite

public setTests(array<string|int, mixed> $tests) : mixed
Parameters
$tests : array<string|int, mixed>
Tags
since

Method available since Release 4.0.0

Return values
mixed

tests()

Returns the tests as an enumeration.

public tests() : array<string|int, mixed>
Return values
array<string|int, mixed>

toString()

Returns a string representation of the test suite.

public toString() : string
Return values
string

addTestMethod()

protected addTestMethod(ReflectionClass $class, ReflectionMethod $method) : mixed
Parameters
$class : ReflectionClass
$method : ReflectionMethod
Return values
mixed

setUp()

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

protected setUp() : mixed
Tags
since

Method available since Release 3.1.0

Return values
mixed

tearDown()

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

protected tearDown() : mixed
Tags
since

Method available since Release 3.1.0

Return values
mixed

Search results