【发布时间】:2016-03-10 15:16:14
【问题描述】:
我正在使用 PHPUnit 5.2.9、PHP 5.6.19 和 Xdebug 2.4.0(非 RC)以及 netbeans IDE。
像任何其他项目一样,我使用接口和奇怪的空扩展类。由于这些文件不包含可执行代码,为什么它们会列在我的代码覆盖率报告中?不仅如此,它们被列为 0% 覆盖的 0/0 方法。 (如果那是 100% 只是为了减少红色,我会很高兴)
我已尝试在 phpunit.xml 文件中排除它们:
<whitelist processUncoveredFilesFromWhitelist="false"> // true make no difference
<directory suffix=".php">./Annotation</directory>
<directory suffix=".php">./Cache</directory>
<exclude>
<directory suffix=".php">./*Interface</directory>
<directory suffix=".php">./*/*Interface</directory>
</exclude>
</whitelist>
但似乎 glob (*) 仅对目录有效。但是,我可以使用 <file> 标签并单独排除它们。但是,有很多文件一开始就不应该被包括在内时要排除。
我做错了什么还是这是标准行为?
【问题讨论】:
-
你实现了那些接口吗?在我的覆盖界面上显示为绿色...
-
@JakubZalas 是的,它们都是我的。在我看来,它们应该是绿色的,但它们被 0% 覆盖并且是红色的。您使用的是 netbeans 以及 PHP Xdebug 的哪些版本?
标签: php phpunit code-coverage xdebug