views:

262

answers:

2

I have created a build.xml file for phing to create code coverage reports. It uses

phpunit codecoverage="true"

and is pointed to the same file(s) as done with phpunit --coverage-html. The result differ, however. With phing I have 100% code coverage for all files, which I have not. There is probably something I don't know about running code coverage with phing that explains this 100%. What am I doing wrong to get differing results?

+1  A: 

You can try running phpunit as an executable and --coverage-html as an argument (This is how we do it and seems to work well).

Example:

<target name="phpunit">
 <exec executable="phpunit" dir="${basedir}/source" failonerror="on">
  <arg line="--log-junit ${basedir}/build/logs/phpunit.xml
  --coverage-clover ${basedir}/build/logs/phpunit.coverage.xml
  --coverage-html ${basedir}/build/coverage
  tests/" />
 </exec>
</target>
Mike B
Thanks for the alternative.
koen
A: 

The SD PHP Test Coverage tool will collect PHP test coverage data across small or large systems of PHP files.

You can see the coverage data in a GUI, or produce a report as text or XML with either the click of a button on the GUI, or the invocation of tool from the command line.

Ira Baxter