/** * @param \PHPUnit_Framework_Test $test */ public function startTest(\PHPUnit_Framework_Test $test) { $annotations = $test->getAnnotations(); // Intercept a single request per test. if (\array_key_exists($this->singleIntercept, $annotations['method'])) { $filename = $annotations['method'][$this->singleIntercept][0]; Http::setSaveFilename($filename); } // Intercept multiple request per test. if (\array_key_exists($this->multiIntercept, $annotations['method'])) { $filename = $annotations['method'][$this->multiIntercept][0]; Http::persistSaveFile($filename); } }
/** * Listener for the start of a test. * * @param \PHPUnit_Framework_Test $test */ public function startTest(\PHPUnit_Framework_Test $test) { $this->timeFrozen = false; if (!$test instanceof \PHPUnit_Framework_TestCase) { return; } $annotations = $test->getAnnotations(); foreach (['method', 'class'] as $context) { if (!isset($annotations[$context][$this->annotation])) { continue; } list($time, ) = $annotations[$context][$this->annotation]; $this->freezeTime($time); break; } }
/** * {@inheritdoc} * @param \PHPUnit_Framework_Test|\PHPUnit_Framework_TestCase $test */ public function startTest(\PHPUnit_Framework_Test $test) { $this->helper->loadFixture($test->getAnnotations()); }
/** * A test ended. * * @param PHPUnit_Framework_Test $test Test case * @param float $time Time taken * * @return void */ public function endTest(PHPUnit_Framework_Test $test, $time) { $this->runs[] = array('name' => $test->getName(), 'size' => $test->getSize(), 'status' => $test->getStatus(), 'statusMessage' => $test->getStatusMessage(), 'assertions' => $test->getNumAssertions(), 'result' => $test->getResult(), 'annotations' => $test->getAnnotations(), 'timeTaken' => $time, 'output' => $test->getActualOutput()); }
/** * A test started. * * @param PHPUnit_Framework_Test $test */ public function startTest(PHPUnit_Framework_Test $test) { if ($test instanceof \PHPUnit_Framework_TestCase) { $annotations = $test->getAnnotations(); if (isset($annotations['method'][$this->annotationName])) { $annotationValue = preg_replace('/\\s+/', '', $annotations['method'][$this->annotationName][0]); $annotationValue = explode(',', $annotationValue); $fakerino = Fakerino\Fakerino::create(); $fakeData = $fakerino->fake($annotationValue)->toArray(); $test->setDependencyInput($fakeData); } } }