phpunit-testingtddsimpletest

PHP SimpleTest HtmlReporter verbose report pass


How could I increase the verbosity of SimpleTest's HtmlReporter?

It is sometimes convenient to see which tests the application passes, in addition to the ones it fails.


Solution

  • Ok, well, it seems I needed more coffee in order to succeed at Google ;)

    They actually answered my questions in a tutorial, just a badly indexed one.

    The gist is that we simply extend a HtmlReporter and define our reporting function. Why didn't they make it an option, it keeps baffling me.

    http://simpletest.org/en/display_subclass_tutorial.html

    class ShowPasses extends HtmlReporter {
    
        function paintPass($message) {
            parent::paintPass($message);
            print "<span class=\"pass\">Pass</span>: ";
            $breadcrumb = $this->getTestList();
            array_shift($breadcrumb);
            print implode("->", $breadcrumb);
            print "->$message<br />\n";
        }
    
        protected function getCss() {
            return parent::getCss() . ' .pass { color: green; }';
        }
    }