PHPStorm排除测试覆盖百分比

时间:2015-06-17 12:02:06

标签: magento phpunit code-coverage phpstorm

我想知道是否可以配置PHPStorm以从百分比中排除Test文件夹,因为我的模块具有100%的覆盖率,但Test文件夹将整体值降低到50%。

Tests bringing percentage down

这可能是无关的,但我也有一个问题,即覆盖窗口从不显示实际的覆盖数据,既不在单独的选项卡中也不在查看文件本身。

Empty coverage data

我可能错误配置了某些东西,或者它与我的项目设置(基于作曲家的Magento项目与符号链接)有关,但我正在撞墙一点。欢迎任何建议。

更新以包含phpunit.xml:

<?xml version="1.0"?>
<!-- initial phpunit configuration file, that you can modify for your project needs -->
<phpunit cacheTokens="true"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         strict="false"
         stderr="true"
         verbose="false"
         bootstrap="app/code/community/EcomDev/PHPUnit/bootstrap.php">
    <listeners>
        <listener file="app/code/community/EcomDev/PHPUnit/Test/Listener.php" class="EcomDev_PHPUnit_Test_Listener"/>
    </listeners>
    <testsuite name="Magento Test Suite">
        <file>app/code/community/EcomDev/PHPUnit/Test/Suite.php</file>
    </testsuite>
    <filter>
        <blacklist>
            <!-- Exclude Magento Core files from code coverage -->
            <directory suffix=".php">app/code/core</directory>
            <!-- Exclude EcomDev_PHPUnit classes from code coverage -->
            <directory suffix=".php">app/code/community/EcomDev/PHPUnit</directory>
            <directory suffix=".php">lib/EcomDev/Utils</directory>
            <directory suffix=".php">lib/EcomDev/PHPUnit</directory>
            <directory suffix=".php">lib/Spyc</directory>
            <directory suffix=".php">lib/vfsStream</directory>
            <!-- Exclude Mage.php file from code coverage -->
            <file>app/Mage.php</file>
            <!-- Exclude template files -->
            <directory suffix=".phtml">app/design</directory>
            <!-- Exclude Varien & Zend libraries -->
            <directory suffix=".php">lib/Varien</directory>
            <directory suffix=".php">lib/Zend</directory>
            <directory suffix=".php">lib/Magento</directory>
        </blacklist>
    </filter>
    <logging>
        <log type="coverage-html" target="var/phpunit/coverage" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
        <log type="coverage-clover" target="var/phpunit/coverage.xml"/>
        <log type="junit" target="var/phpunit/junit.xml" logIncompleteSkipped="false"/>
    </logging>
</phpunit>

我认为它可能是PHPStorm的原因是HTML版本的覆盖率完美无缺,正确排除了Test文件夹。

Correct coverage in HTML view

1 个答案:

答案 0 :(得分:2)

这与PhpStorm无关。您只需为项目配置whitelist

相关问题