我正在使用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>
但看起来globs(*)仅对目录有效 . 但是,我可以使用 <file>
标记并单独排除它们 . 但是,首先要包括在内 .
我做错了什么还是这种标准行为?
1 回答
您可以尝试改进排除目录,如下所示:
另外,您可以直接在忽略代码Blocks of the doc中描述的代码正确标注中进行标记,如下所示:
或者您可以在测试用例中标记为覆盖接口类的方法,请参阅更多信息in the doc here . 例如:
希望这有帮助