这是phpunit.xml
:
<phpunit
bootstrap="bootstrap.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
stopOnError="false"
stopOnIncomplete="false"
stopOnSkipped="false">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../modules</directory>
<directory suffix=".php">../models</directory>
<directory suffix=".php">../lib</directory>
<directory suffix=".php">../components</directory>
<exclude>
<directory suffix=".php">../modules/*/views</directory>
<directory suffix=".php">../modules/*/widgets</directory>
<directory suffix=".php">../modules/*/controllers</directory>
<directory suffix=".php">../modules/ClaimProfile</directory>
<directory suffix=".php">../modules/SocialNetworks</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml" />
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="true" />
</logging>
</phpunit>
结果clover.xml
确实包括命名空间类的信息,并且除了 Jenkins 的 PHP-Clover 插件之外的所有插件都会报告覆盖率,而忽略命名空间内的代码。(即,报告中不显示定义命名空间的源文件,但列表中显示了代码完全属于全局命名空间的文件)。