Jan 09 2011

PHPUnit code coverage output in Windows including PHPUnit classes

Having just to got to the point where I was happy with my distributed project builds on Windows and Linux, I discovered my code coverage reports generated by PHPUnit were different between the two.

On the Linux machine, just the classes I expected were included in the report. On Windows however, it included some of the PHPUnit classes.

Turns out I had to create a phpunit.xml configuration file and include a whitelist of files.

For example:

<?xml version="1.0" encoding="UTF-8"?>
                <directory suffix=".php">./src</directory>
            <log type="junit" target="./build/logs/testsuites.xml"/>
            <log type="coverage-clover" target="./build/logs/coverage-clover.xml"/>
comments powered by Disqus


I'm Ade Slade, a PHP web developer.