Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHPUnit代码覆盖率不适用于配置_Php_Unit Testing_Code Coverage_Phpunit - Fatal编程技术网

PHPUnit代码覆盖率不适用于配置

PHPUnit代码覆盖率不适用于配置,php,unit-testing,code-coverage,phpunit,Php,Unit Testing,Code Coverage,Phpunit,我的PHPUnit设置和覆盖率报告在没有白名单过滤器的情况下运行良好。然而,一旦我添加了一个,报告似乎只生成了一部分,就好像PHPUnit意外退出一样。我没有收到任何错误或警告 我的配置卡通看起来像这样: <?xml version="1.0" encoding="UTF-8"?> <phpunit bootstrap="./bootstrap.php" colors="true"> <testsuites> <

我的PHPUnit设置和覆盖率报告在没有白名单过滤器的情况下运行良好。然而,一旦我添加了一个,报告似乎只生成了一部分,就好像PHPUnit意外退出一样。我没有收到任何错误或警告

我的配置卡通看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./bootstrap.php"
         colors="true">
    <testsuites>
        <testsuite name="...">
            <testsuite name="...">
                <directory>./path/to/suite</directory>
            </testsuite>
            <testsuite name="...">
                <directory>./path/to/suite2</directory>
            </testsuite>
            <testsuite name="...">
                <directory>./path/to/suite3</directory>
            </testsuite>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory suffix=".php">../path/to/files</directory>
        </whitelist>
    </filter>

    <logging>
        <log type="coverage-html" target="log/" charset="UTF-8" yui="true" />
    </logging>
</phpunit>

/path/to/suite
./path/to/suite2
/路径/到/套件3
../path/to/files

你知道会出什么问题吗?

结果是在我被列入白名单的文件中有一些脚本停止了程序代码。

很抱歉,我翻了一个旧的,但我在谷歌上搜索了phpunit代码覆盖范围不起作用,这个出现了

我让代码覆盖率按原样运行(想想xdebug是用来实现它的),这在一段时间内还不错

然后,当我创建一个新测试时,它突然停止工作,运行的代码被标记为未覆盖

我用phpunit创建的测试类:phpunit skelgen--test

它会创建覆盖率注释,如:@covers MyClass::someMethod

删除它们为我解决了这个问题,xdebug现在又被使用了,并且突然有了100%的覆盖率

关于覆盖面的一点意见;仅调用一个方法就可以在报告中覆盖它,但大多数情况下不能被视为已覆盖。使用空值和无效值调用它会覆盖它

是,硬
DIE()
退出将停止PHPunit覆盖率报告。