Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/simpletestlib/ui/colortext_reporter.php
Go to the documentation of this file.
00001 <?php
00012 require_once(dirname(__FILE__) . '/../reporter.php');
00013 
00014 
00027 class ColorTextReporter extends TextReporter { 
00028     var $_failColor = 41;
00029     var $_passColor = 42;
00030     
00036     function ColorTextReporter() {
00037         parent::TextReporter();
00038     }
00039     
00048     function paintFooter($test_name) {
00049         ob_start();
00050         parent::paintFooter($test_name);
00051         $output = trim(ob_get_clean());
00052         if ($output) {
00053             if (($this->getFailCount() + $this->getExceptionCount()) == 0) {
00054                 $color = $this->_passColor;
00055             } else {
00056                 $color = $this->_failColor;
00057             }
00058             
00059             $this->_setColor($color);
00060             echo $output;
00061             $this->_resetColor();
00062         }
00063     }
00064     
00065     
00072     function _setColor($color) {
00073         printf("%s[%sm\n", chr(27), $color);
00074     }
00075     
00076     
00082     function _resetColor() {
00083         $this->_setColor(0);
00084     }
00085 }
00086 
 All Data Structures Namespaces Files Functions Variables Enumerations