public function paintFooter($test_name) { ob_start(); parent::paintFooter($test_name); $output = ob_get_contents(); ob_end_clean(); if ($this->terminal->shouldColor()) { if ($this->getFailCount() + $this->getExceptionCount() == 0) { echo Coloring::green($output); } else { echo Coloring::red($output); } } else { echo $output; } if ($this->runner->shouldNotify()) { if ($this->getFailCount() + $this->getExceptionCount() == 0) { $notificationResult = Notification::RESULT_PASSED; } else { $notificationResult = Notification::RESULT_FAILED; } $this->notification = new Notification($notificationResult, $output); } }
/** * @param string $name * @param bool $success * * @since Method available since Release 2.7.0 */ protected function onTest($name, $success = true) { if (!strlen($name)) { return; } $testStatus = $this->testStatuses[$name]; if ($this->testStatuses[$name] == \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE || $this->testStatuses[$name] == \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) { if (strlen($this->testStatusMessages[$name])) { $name = $name . ' (' . str_replace(array("\r", "\n"), '', $this->testStatusMessages[$name]) . ')'; } } if ($this->terminal->shouldColor()) { switch ($testStatus) { case \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED: $name = Coloring::green($name); break; case \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR: $name = Coloring::magenta($name); break; case \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE: $name = Coloring::red($name); break; case \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE: case \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED: $name = Coloring::yellow($name); break; } } parent::onTest($name, $success); }
/** * A test ended. * * @param \PHPUnit_Framework_Test $test * @param float $time */ public function endTest(\PHPUnit_Framework_Test $test, $time) { if (!$this->lastTestFailed) { $message = 'passed'; $this->write($this->colors ? Coloring::green($message) : $message); } parent::endTest($test, $time); $this->lastEvent = \PHPUnit_TextUI_ResultPrinter::EVENT_TEST_END; }
/** * A test ended. * * @param \PHPUnit_Framework_Test $test * @param float $time */ public function endTest(\PHPUnit_Framework_Test $test, $time) { if ($this->colors && !$this->lastTestFailed) { $this->writeProgress(Coloring::green('.')); $this->lastTestFailed = true; } parent::endTest($test, $time); $this->lastEvent = self::EVENT_TEST_END; }