我正在使用PHPUnit运行模块测试,并希望获得有关测试的覆盖率报告。过去我已经成功地做到了这一点,但不知何故,我再也无法工作,我不知道为什么它不再工作。唯一的区别是我现在运行PHP 5.4而不是5.3。PHPUnit代码覆盖率0%
测试在Ant构建文件使用exec命令来运行:
<exec dir="${basedir}" executable="phpunit.bat" failonerror="${test.failonerror}">
<arg value="--log-junit" />
<arg value="${test.phpunit.log}" />
<arg value="--coverage-clover" />
<arg value="${test.phpunit.coverage.log}" />
<arg value="--bootstrap" />
<arg value="${test.phpunit.bootstrap}" />
<arg value="${test.phpunit.testdir}" />
</exec>
这里是蚂蚁日志的片段时,我跑我的测试:
module-test-php:
[exec] PHPUnit 3.6.12 by Sebastian Bergmann.
[exec] .............
[exec] Time: 5 seconds, Memory: 8.75Mb
[exec] OK (13 tests, 113 assertions)
[exec] Generating code coverage report in Clover XML format ... done
从日志,它似乎覆盖面报告应该工作,但是当我打开报告,我得到的是这个
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1344329670">
<project timestamp="1344329670">
<metrics files="0" loc="0" ncloc="0" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</project>
</coverage>
是否有一些设置我在这里失踪或为什么我得到零覆盖?
更新
我做了一些更多的测试,发现错误有关Phar归档。这个问题已被报道。
https://github.com/sebastianbergmann/php-code-coverage/issues/107