/** * @constructor * @param string $theClass * @param string $name */ public function __construct($theClass = '', $name = '') { $this->initObjectManager(); $this->testSuiteFactory = $this->objectManager->get('Mtf\\TestSuite\\TestSuiteFactory'); /** @var $testIterator \Mtf\Util\Iterator\TestCase */ $testIterator = $this->objectManager->create('Mtf\\Util\\Iterator\\TestCase'); while ($testIterator->valid()) { $arguments = $testIterator->current(); $class = $arguments['class']; $factory = $this->testSuiteFactory; $testCallback = $this->objectManager->create('Mtf\\TestSuite\\Callback', ['factory' => $factory, 'arguments' => $arguments, 'theClass' => $class]); $rule = $this->objectManager->get('Mtf\\TestRunner\\Rule\\SuiteComposite'); $testCaseSuite = $this->testSuiteFactory->get($class); $allow = $rule->filterSuite($testCaseSuite); if ($allow) { $this->addTest($testCallback, \PHPUnit_Util_Test::getGroups($class)); } $testIterator->next(); } parent::__construct($name); }
/** * Run callback * * @param \PHPUnit_Framework_TestResult $result * @return \PHPUnit_Framework_TestResult | void */ public function run(\PHPUnit_Framework_TestResult $result = null) { $testClass = $this->factory->create($this->getName(), $this->arguments); return $testClass->run($result); }