/** * Informs the result that a test was completed. * * @param PHPUnit_Framework_Test $test * @param float $time */ public function endTest(PHPUnit_Framework_Test $test, $time) { foreach ($this->listeners as $listener) { $listener->endTest($test, $time); } if (!$this->lastTestFailed && $test instanceof PHPUnit_Framework_TestCase) { $class = get_class($test); $key = $class . '::' . $test->getName(); $this->passed[$key] = ['result' => $test->getResult(), 'size' => PHPUnit_Util_Test::getSize($class, $test->getName(false))]; $this->time += $time; } }
/** * Returns the size of the test. * * @return integer * @since Method available since Release 3.6.0 */ public function getSize() { return PHPUnit_Util_Test::getSize(get_class($this), $this->getName(false)); }
/** * @since Method available since Release 3.5.4 */ protected function handleDependencies() { if (!empty($this->dependencies) && !$this->inIsolation) { $className = get_class($this); $passed = $this->result->passed(); $passedKeys = array_keys($passed); $numKeys = count($passedKeys); for ($i = 0; $i < $numKeys; $i++) { $pos = strpos($passedKeys[$i], ' with data set'); if ($pos !== FALSE) { $passedKeys[$i] = substr($passedKeys[$i], 0, $pos); } } $passedKeys = array_flip(array_unique($passedKeys)); foreach ($this->dependencies as $dependency) { if (strpos($dependency, '::') === FALSE) { $dependency = $className . '::' . $dependency; } if (!isset($passedKeys[$dependency])) { $this->result->addError($this, new PHPUnit_Framework_SkippedTestError(sprintf('This test depends on "%s" to pass.', $dependency)), 0); return FALSE; } $size = PHPUnit_Util_Test::getSize($className, $this->getName(FALSE)); if (isset($passed[$dependency])) { if ($passed[$dependency]['size'] > $size) { $this->result->addError($this, new PHPUnit_Framework_SkippedTestError('This test depends on a test that is larger than itself.'), 0); return FALSE; } $this->dependencyInput[] = $passed[$dependency]['result']; } else { $this->dependencyInput[] = NULL; } } } return TRUE; }