specTester = $specTester; } /** * {@inheritdoc} */ public function setUp(Environment $env, SpecificationIterator $iterator, $skip) { return new SuccessfulSetup(); } /** * {@inheritdoc} */ public function test(Environment $env, SpecificationIterator $iterator, $skip = false) { $results = array(); foreach ($iterator as $specification) { $setup = $this->specTester->setUp($env, $specification, $skip); $localSkip = !$setup->isSuccessful() || $skip; $testResult = $this->specTester->test($env, $specification, $localSkip); $teardown = $this->specTester->tearDown($env, $specification, $localSkip, $testResult); // start modifications here if (!$testResult->isPassed()) { file_put_contents('php://stdout', 'Retrying specification' . PHP_EOL); $setup = $this->specTester->setUp($env, $specification, $skip); $localSkip = !$setup->isSuccessful() || $skip; $testResult = $this->specTester->test($env, $specification, $localSkip); $teardown = $this->specTester->tearDown($env, $specification, $localSkip, $testResult); } // end modifications here $integerResult = new IntegerTestResult($testResult->getResultCode()); $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); } return new TestResults($results); } /** * {@inheritdoc} */ public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result) { return new SuccessfulTeardown(); } }