【问题标题】:How to exclude directories from phpunit coverage report如何从 phpunit 覆盖率报告中排除目录
【发布时间】:2013-08-14 15:49:33
【问题描述】:

我尝试了以下配置:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
    <testsuites>
      <testsuite name="My Test Suite">
         <directory suffix=".php">Test/Case/Model</directory>
        <exclude>Test/Case/Model/Behavior</exclude>
      </testsuite>
    </testsuites>
</phpunit>

但它不会从覆盖率报告中排除该行为。如何从覆盖率报告中排除这些目录或文件?

【问题讨论】:

    标签: phpunit


    【解决方案1】:

    请参阅the exclude element phpunit documentation

    这是一个例子phpunit.xml

    <?xml version="1.0" encoding="utf-8"?>
    <phpunit>
      <filter>
        <whitelist>
          <directory suffix=".php">../</directory>
          <exclude>
            <file>../ext_emconf.php</file>
            <directory suffix=".php">../tests</directory>
          </exclude>
        </whitelist>
      </filter>
    </phpunit>
    

    【讨论】:

    • 关于你的年龄,是不是打错字了? ;)
    • 我总是告诉互联网上的随机网站我的真实生日。
    • 所以计算我的年龄为 13
    猜你喜欢
    • 1970-01-01
    • 2011-11-26
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    • 1970-01-01
    • 2014-04-16
    • 2019-04-24
    • 2015-08-24
    相关资源
    最近更新 更多