class PHPUnit_Extensions_GroupTestSuite in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Extensions/GroupTestSuite.php \PHPUnit_Extensions_GroupTestSuite
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 @group C and @group D in TestSuite object A to be run twice .
<code> $suite = new PHPUnit_Extensions_GroupTestSuite($A, array('C', 'D')); </code>
@since Class available since Release 3.3.0
Hierarchy
- class \PHPUnit_Framework_TestSuite implements \IteratorAggregate, PHPUnit_Framework_SelfDescribing, PHPUnit_Framework_Test
Expanded class hierarchy of PHPUnit_Extensions_GroupTestSuite
File
- vendor/
phpunit/ phpunit/ src/ Extensions/ GroupTestSuite.php, line 25
View source
class PHPUnit_Extensions_GroupTestSuite extends PHPUnit_Framework_TestSuite {
public function __construct(PHPUnit_Framework_TestSuite $suite, array $groups) {
$groupSuites = array();
$name = $suite
->getName();
foreach ($groups as $group) {
$groupSuites[$group] = new PHPUnit_Framework_TestSuite($name . ' - ' . $group);
$this
->addTest($groupSuites[$group]);
}
$tests = new RecursiveIteratorIterator(new PHPUnit_Util_TestSuiteIterator($suite), RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($tests as $test) {
if ($test instanceof PHPUnit_Framework_TestCase) {
$testGroups = PHPUnit_Util_Test::getGroups(get_class($test), $test
->getName(false));
foreach ($groups as $group) {
foreach ($testGroups as $testGroup) {
if ($group == $testGroup) {
$groupSuites[$group]
->addTest($test);
}
}
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PHPUnit_Extensions_GroupTestSuite:: |
public | function |
Constructs a new TestSuite: Overrides PHPUnit_Framework_TestSuite:: |
|
PHPUnit_Framework_TestSuite:: |
protected | property | Enable or disable the backup and restoration of the $GLOBALS array. | |
PHPUnit_Framework_TestSuite:: |
protected | property | Enable or disable the backup and restoration of static attributes. | |
PHPUnit_Framework_TestSuite:: |
private | property | Last count of tests in this suite. | |
PHPUnit_Framework_TestSuite:: |
private | property | ||
PHPUnit_Framework_TestSuite:: |
protected | property | ||
PHPUnit_Framework_TestSuite:: |
protected | property | The test groups of the test suite. | |
PHPUnit_Framework_TestSuite:: |
private | property | ||
PHPUnit_Framework_TestSuite:: |
protected | property | The name of the test suite. | |
PHPUnit_Framework_TestSuite:: |
protected | property | The number of tests in the test suite. | |
PHPUnit_Framework_TestSuite:: |
protected | property | ||
PHPUnit_Framework_TestSuite:: |
protected | property | ||
PHPUnit_Framework_TestSuite:: |
protected | property | The tests in the test suite. | |
PHPUnit_Framework_TestSuite:: |
public | function | Adds a test to the suite. | |
PHPUnit_Framework_TestSuite:: |
public | function | Wraps both <code>addTest()</code> and <code>addTestSuite</code> as well as the separate import statements for the user's convenience. | |
PHPUnit_Framework_TestSuite:: |
public | function | Wrapper for addTestFile() that adds multiple test files. | |
PHPUnit_Framework_TestSuite:: |
protected | function | ||
PHPUnit_Framework_TestSuite:: |
public | function | Adds the tests from the given class to the suite. | |
PHPUnit_Framework_TestSuite:: |
public | function | Counts the number of test cases that will be run by this test. | |
PHPUnit_Framework_TestSuite:: |
protected | function | Creates a default TestResult object. | |
PHPUnit_Framework_TestSuite:: |
public static | function | ||
PHPUnit_Framework_TestSuite:: |
public | function | ||
PHPUnit_Framework_TestSuite:: |
public | function | Returns the test groups of the suite. | |
PHPUnit_Framework_TestSuite:: |
public | function | Returns an iterator for this test suite. | |
PHPUnit_Framework_TestSuite:: |
public | function | Returns the name of the suite. | |
PHPUnit_Framework_TestSuite:: |
protected static | function | @since Method available since Release 4.3.0 | |
PHPUnit_Framework_TestSuite:: |
public | function | ||
PHPUnit_Framework_TestSuite:: |
public static | function | ||
PHPUnit_Framework_TestSuite:: |
public | function | Mark the test suite as skipped. | |
PHPUnit_Framework_TestSuite:: |
public | function |
Runs the tests and collects their result in a TestResult. Overrides PHPUnit_Framework_Test:: |
|
PHPUnit_Framework_TestSuite:: |
public | function | Runs a test. | |
PHPUnit_Framework_TestSuite:: |
public | function | @since Method available since Release 3.3.0 | |
PHPUnit_Framework_TestSuite:: |
public | function | @since Method available since Release 3.4.0 | |
PHPUnit_Framework_TestSuite:: |
public | function | @since Method available since Release 4.6.0 | |
PHPUnit_Framework_TestSuite:: |
public | function | Set tests groups of the test case | |
PHPUnit_Framework_TestSuite:: |
public | function | Sets the name of the suite. | |
PHPUnit_Framework_TestSuite:: |
public | function | @since Method available since Release 3.7.0 | |
PHPUnit_Framework_TestSuite:: |
public | function | Set tests of the test suite | |
PHPUnit_Framework_TestSuite:: |
protected | function | Template Method that is called before the tests of this test suite are run. | |
PHPUnit_Framework_TestSuite:: |
protected static | function | @since Method available since Release 4.3.0 | |
PHPUnit_Framework_TestSuite:: |
protected | function | Template Method that is called after the tests of this test suite have finished running. | |
PHPUnit_Framework_TestSuite:: |
public | function | Returns the test at the given index. | |
PHPUnit_Framework_TestSuite:: |
public | function | Returns the tests as an enumeration. | |
PHPUnit_Framework_TestSuite:: |
public | function |
Returns a string representation of the test suite. Overrides PHPUnit_Framework_SelfDescribing:: |
|
PHPUnit_Framework_TestSuite:: |
protected static | function |