/** * @param RecursiveIterator $iterator * @param array $groups * @param PHPUnit_Framework_TestSuite $suite */ public function __construct(RecursiveIterator $iterator, array $groups, PHPUnit_Framework_TestSuite $suite) { parent::__construct($iterator); foreach ($suite->getGroupDetails() as $group => $tests) { if (in_array($group, $groups)) { $testHashes = array_map(function ($test) { return spl_object_hash($test); }, $tests); $this->groupTests = array_merge($this->groupTests, $testHashes); } } }
/** * Marks tests within suite that needs OXID (by annotation) * * @param \PHPUnit_Framework_TestSuite $suite * @throws \RuntimeException */ protected function markTestsThatNeedOXID(\PHPUnit_Framework_TestSuite $suite) { if (false === in_array('needs-oxid', $suite->getGroups())) { return; } $groupedTests = $suite->getGroupDetails(); foreach ($groupedTests['needs-oxid'] as $test) { if ($test instanceof \PHPUnit_Framework_TestSuite) { continue; } if (false === method_exists($test, 'setNeedsOXID')) { throw new \RuntimeException(sprintf('Test "%s" must extend "SrUnit\\TestCase" - is derived from "%s".', get_class($test), get_parent_class($test))); } $test->setNeedsOXID(true); } }