I'm just unit testing a single file and although it's the only one to get unit tested (good), code coverage is done on more than just this single file (bad). It covers some files in my PEAR directory for some reason I can't understand yet, so all my coverage stats are distorted.
So I'm trying to eliminate these extra files, but can't get the format right for an absolute directory:
<phpunit>
<testsuites>
<testsuite name="My Test Suite">
<file>AntProxyTest.php</file>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="/tmp/report" charset="UTF-8"
yui="true" highlight="false"
lowUpperBound="35" highLowerBound="70"/>
</logging>
<filter>
<blacklist>
<directory suffix=".php">c:\php\pear</directory>
</blacklist>
</filter>
</phpunit>
is not excluding as I wish, either are forward slashes or file://c:/php/pear.
I managed to catch Sebastian on IRC, co-incidentally someone else was also having problems with blacklisting. Sebastian indicated that these PEAR files I'm seeing included is a known issue and will be fixed next version.
As edorian above indicated, Sebastian also said it's a best practice to whitelist what you want anyway, and in doing so, this problem will disappear.
I assume phpunit has an issue with getting that path right on windows since i couldn't reproduce that on linux. (Using an absolute and an relative path worked fine).
Also i've heard people talk about that issue with filtering and pathes on windows.
So my first suggestion would be to just use a whitelist. I've created a small project that includes code from different folders (and all showed up in the code coverage).
But after setting this whitelist:
<filter>
<whitelist>
<directory suffix=".php">.</directory>
</whitelist>
</filter>
only the code from that folder (or your file if you really one have one) show up in the coverage report.