Source for file ResultPrinter.php
Documentation is available at ResultPrinter.php
// +------------------------------------------------------------------------+
// +------------------------------------------------------------------------+
// | Copyright (c) 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
// +------------------------------------------------------------------------+
// | This source file is subject to version 3.00 of the PHP License, |
// | that is available at http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +------------------------------------------------------------------------+
// $Id: ResultPrinter.php,v 1.5 2004/04/24 06:23:57 sebastian Exp $
require_once 'PHPUnit2/Framework/TestFailure.php';
require_once 'PHPUnit2/Framework/TestListener.php';
require_once 'PHPUnit2/Framework/TestResult.php';
require_once 'PHPUnit2/Util/Filter.php';
require_once 'PHPUnit2/Util/Printer.php';
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @copyright Copyright © 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
// {{{ public function printResult(PHPUnit2_Framework_TestResult $result, $timeElapsed)
* @param PHPUnit2_Framework_TestResult $result
public function printResult(PHPUnit2_Framework_TestResult $result, $timeElapsed) {
// {{{ protected function printDefects($defects, $count, $type)
($count == 1 ) ? 'was' : 'were',
foreach ($defects as $defect) {
// {{{ protected function printDefect(PHPUnit2_Framework_TestFailure $defect, $count)
* @param PHPUnit2_Framework_TestFailure $defect
protected function printDefect(PHPUnit2_Framework_TestFailure $defect, $count) {
// {{{ protected function printDefectHeader(PHPUnit2_Framework_TestFailure $defect, $count)
* @param PHPUnit2_Framework_TestFailure $defect
protected function printDefectHeader(PHPUnit2_Framework_TestFailure $defect, $count) {
$name = $defect->failedTest ()->getName ();
$class = new ReflectionClass ($defect->failedTest ());
// {{{ protected function printDefectTrace(PHPUnit2_Framework_TestFailure $defect)
* @param PHPUnit2_Framework_TestFailure $defect
$e = $defect->thrownException ();
$message = method_exists($e, 'toString') ? $e->toString () : $e->getMessage ();
$this->write($message . "\n");
$defect->thrownException ()
// {{{ protected function printErrors(PHPUnit2_Framework_TestResult $result)
* @param PHPUnit2_Framework_TestResult $result
protected function printErrors(PHPUnit2_Framework_TestResult $result) {
$this->printDefects($result->errors (), $result->errorCount (), 'error');
// {{{ protected function printFailures(PHPUnit2_Framework_TestResult $result)
* @param PHPUnit2_Framework_TestResult $result
protected function printFailures(PHPUnit2_Framework_TestResult $result) {
$this->printDefects($result->failures (), $result->failureCount (), 'failure');
// {{{ protected function printIncompletes(PHPUnit2_Framework_TestResult $result)
* @param PHPUnit2_Framework_TestResult $result
$this->printDefects($result->notImplemented (), $result->notImplementedCount (), 'incomplete testcase');
// {{{ protected function printHeader($timeElapsed)
* @param float $timeElapsed
// {{{ protected function printFooter(PHPUnit2_Framework_TestResult $result)
* @param PHPUnit2_Framework_TestResult $result
protected function printFooter(PHPUnit2_Framework_TestResult $result) {
if ($result->allCompletlyImplemented () &&
$result->wasSuccessful ()) {
($result->runCount () == 1 ) ? '' : 's'
else if (!$result->allCompletlyImplemented () &&
$result->wasSuccessful ()) {
"\nOK, but incomplete test cases!!!\nTests run: %d, incomplete test cases: %d.\n",
$result->notImplementedCount ()
"\nFAILURES!!!\nTests run: %d, Failures: %d, Errors: %d, Incomplete Tests: %d.\n",
$result->notImplementedCount ()
// {{{ public function printWaitPrompt()
$this->write("\n<RETURN> to continue\n");
// {{{ public function addError(PHPUnit2_Framework_Test $test, Exception $e)
* @param PHPUnit2_Framework_Test $test
public function addError(PHPUnit2_Framework_Test $test, Exception $e) {
// {{{ public function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e)
* @param PHPUnit2_Framework_Test $test
* @param PHPUnit2_Framework_AssertionFailedError $e
public function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e) {
// {{{ public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e)
* @param PHPUnit2_Framework_Test $test
// {{{ public function endTest(PHPUnit2_Framework_Test $test)
* @param PHPUnit2_Framework_Test $test
public function endTest(PHPUnit2_Framework_Test $test) {
// {{{ public function startTest(PHPUnit2_Framework_Test $test)
* @param PHPUnit2_Framework_Test $test
public function startTest(PHPUnit2_Framework_Test $test) {
if ($this->column++ >= 40 ) {
* vim600: et sw=2 ts=2 fdm=marker
Documentation generated on Mon, 11 Mar 2019 13:55:58 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|