/** * Adds a test to the suite. * * @param PHPUnit_Framework_Test $test * @param array $groups */ public function addTest(PHPUnit_Framework_Test $test, $groups = []) { $class = new ReflectionClass($test); if (!$class->isAbstract()) { $this->tests[] = $test; $this->numTests = -1; if ($test instanceof self && empty($groups)) { $groups = $test->getGroups(); } if (empty($groups)) { $groups = ['default']; } foreach ($groups as $group) { if (!isset($this->groups[$group])) { $this->groups[$group] = [$test]; } else { $this->groups[$group][] = $test; } } if ($test instanceof PHPUnit_Framework_TestCase) { $test->setGroups($groups); } } }