ā€¦ and a little bit help of PHPUnit2.

For our CMS, we use SimpleTest as testing framework. We used it in other projects, and as you should never change a running team, we sticked to that for Flux CMS as well. And the WebTesting classes are just great for something webbased (besides the ā€œtraditionalā€ unit test classes provided by SimpleTest).

But one thing I saw over at PHPUnit2 and badly wanted to have, was the Code-Coverage Analysis. The pure coverage data comes from Xdebug PHPUnit2 ā€œjustā€ displays it nicely based on that. A quick look into the code revealed that it was easy to just use the CodeCoverage classes and so I integrated it in our testing framework. The output looks then something like this:

200601051024

As you can see, we almost covered all lines of the makeUri method :)

And the needed code for adding CodeCoverage output basically was:

if (function_exists("xdebug_start_code_coverage")) {
    xdebug_start_code_coverage();
}
$ret = $psuite->run($preporter);
if (function_exists("xdebug_start_code_coverage")) {
    $cc =  PHPUnit2_Util_CodeCoverage_Renderer::factory('html',array('tests' => xdebug_get_code_coverage()));
    $cc->renderToFile('cov.html');
}

Thanks for the great jobs to Sebastian, Derick and Marcus. And Andreas for the glue of the testing framework.