3 * Base include file for SimpleTest
5 * @subpackage UnitTester
10 * include base reporter
12 require_once(dirname(__FILE__
) . '/../reporter.php');
16 * Provides an ANSI-colored {@link TextReporter} for viewing test results.
18 * This code is made available under the same terms as SimpleTest. It is based
19 * off of code that Jason Sweat originally published on the SimpleTest mailing
22 * @author Jason Sweat (original code)
23 * @author Travis Swicegood <development@domain51.com>
25 * @subpackage UnitTester
27 class ColorTextReporter
extends TextReporter
{
32 * Handle initialization
34 * @param {@link TextReporter}
36 function ColorTextReporter() {
37 parent
::TextReporter();
41 * Capture the attempt to display the final test results and insert the
42 * ANSI-color codes in place.
48 function paintFooter($test_name) {
50 parent
::paintFooter($test_name);
51 $output = trim(ob_get_clean());
53 if (($this->getFailCount() +
$this->getExceptionCount()) == 0) {
54 $color = $this->_passColor
;
56 $color = $this->_failColor
;
59 $this->_setColor($color);
67 * Sets the terminal to an ANSI-standard $color
72 function _setColor($color) {
73 printf("%s[%sm\n", chr(27), $color);
78 * Resets the color back to normal.
82 function _resetColor() {