首页 > 解决方案 > PhpStorm shows 0% code coverage, but PhpUnit coverage results are 100%

问题描述

I think I have something wrong with PhpStorm configuration, because when I run PhpUnit configuration with coverage, statistic shows 0%, but HTML report from PhpUnit shows 100%.

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
    <php>
        <const name="PHPUNIT_TESTSUITE_RESULTCACHE" value="true"/>
    </php>
    <testsuites>
        <testsuite name="Unit Test Suite">
            <directory>./</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">../src</directory>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="./coverage/" lowUpperBound="35" highLowerBound="70"/>
    </logging>
</phpunit>

Coverage HTML report: https://prnt.sc/moj2oy

PhpStorm statistics: https://prnt.sc/moj3mp

Any ideas?

标签: phpunitphpstormcode-coverage

解决方案


推荐阅读