function TestSuite::addTest
Adds a test to the suite.
3 calls to TestSuite::addTest()
- TestSuite::addTestFile in vendor/
phpunit/ phpunit/ src/ Framework/ TestSuite.php - Wraps both <code>addTest()</code> and <code>addTestSuite</code> as well as the separate import statements for the user's convenience.
- TestSuite::addTestMethod in vendor/
phpunit/ phpunit/ src/ Framework/ TestSuite.php - TestSuite::addTestSuite in vendor/
phpunit/ phpunit/ src/ Framework/ TestSuite.php - Adds the tests from the given class to the suite.
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ TestSuite.php, line 173
Class
- TestSuite
- @template-implements IteratorAggregate<int, Test>
Namespace
PHPUnit\FrameworkCode
public function addTest(Test $test, array $groups = []) : void {
$class = new ReflectionClass($test);
if ($class->isAbstract()) {
return;
}
$this->tests[] = $test;
$this->clearCaches();
if ($test instanceof self && empty($groups)) {
$groups = $test->groups();
}
if ($this->containsOnlyVirtualGroups($groups)) {
$groups[] = 'default';
}
foreach ($groups as $group) {
if (!isset($this->groups[$group])) {
$this->groups[$group] = [
$test,
];
}
else {
$this->groups[$group][] = $test;
}
}
if ($test instanceof TestCase) {
$test->setGroups($groups);
}
}