Source for file Default.php
Documentation is available at Default.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* This file is part of the PEAR Testing_DocTest package.
* LICENSE: This source file is subject to the MIT license that is available
* through the world-wide-web at the following URI:
* http://opensource.org/licenses/mit-license.php
* @package Testing_DocTest
* @author David JEAN LOUIS <izimobil@gmail.com>
* @copyright 2008 David JEAN LOUIS
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://pear.php.net/package/Testing_DocTest
* @since File available since release 0.1.0
require_once 'Testing/DocTest/OutputterInterface.php';
* DocTest Outputter default class.
* @package Testing_DocTest
* @author David JEAN LOUIS <izimobil@gmail.com>
* @copyright 2008 David JEAN LOUIS
* @license http://opensource.org/licenses/mit-license.php MIT License
* @version Release: 0.3.0
* @link http://pear.php.net/package/Testing_DocTest
* @since Class available since release 0.1.0
* @var resource $_logfile
private $_logfile = false;
$this->_logfile = fopen($reg->logfile , 'wb');
$this->_time = $time[1 ] + $time[0 ];
* Will eventually close the opened logfile.
if (false !== $this->_logfile && is_resource($this->_logfile)) {
* Begin of the DocTest session.
* @param array $files a multidimensional array of file=>testcase array
public function begin(array $files)
$this->_output ("Nothing to process.\n");
* End of the DocTest session.
* @param array $files a multidimensional array of file=>testcase array
public function end(array $files)
$t = ($time[1 ] + $time[0 ]) - $this->_time;
$passed = $skipped = $failed = $error = 0;
foreach ($files as $file=> $tbArray) {
foreach ($tbArray as $tb) {
$this->_output (sprintf("\nTotal time : %.4f sec.\n", $t));
$this->_output (" Passed tests : $passed\n" );
$this->_output (" Skipped tests : $skipped\n" );
$this->_output (" Failed tests : $failed\n\n" );
* @param string $file path to the file that will be processed
* @param array $testCaseArray an array of test case instances
public function beginFile($file, array $testCaseArray)
* @param string $file path to the file that will be processed
* @param array $testCaseArray an array of test case instances
public function endFile ($file, array $testCaseArray)
* Begin of test case parsing.
* @param object $testCase a test case instance
public function beginTestCase (Testing_DocTest_TestCase $testCase)
* End of test case parsing.
* @param object $testCase a test case instance
public function endTestCase(Testing_DocTest_TestCase $testCase)
$name = sprintf("%s in file \"%s\"\n",
$testCase->name , $testCase->file);
$this->_output ('[SKIP] ', 33 );
$this->_output ('[PASS] ', 32 );
$this->_output ('[ERROR] ', 31 , true );
$this->_output ('[FAIL] ', 31 , true );
$this->_output ($name, false , true );
$this->_output ($testCase->expectedValue . "\n", false , true );
$this->_output ($testCase->actualValue . "\n", false , true );
$this->_output (str_repeat('-', 72 ) . "\n", false , true );
* Writes the message $msg to STDOUT or to the logfile.
* @param string $msg the message to output
* @param int $color the color code (optional)
* @param bool $force force output even if quiet mode
private function _output ($msg, $color=false , $force=false )
if ($reg->quiet && !$force) {
if ($color && !$reg->no_colors && !$this->_logfile ) {
echo " \033[{$color}m" . $msg . "\033[0;0m";
fwrite($this->_logfile , $msg);
Documentation generated on Mon, 11 Mar 2019 15:18:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|