gpt4 book ai didi

magento - PHPStorm 从覆盖百分比中排除测试

转载 作者:行者123 更新时间:2023-12-04 20:38:30 24 4
gpt4 key购买 nike

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

Tests bringing percentage down

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

Empty coverage data

可能是我配置错误,或者与我的项目设置有关(基于 Composer 的带有符号链接(symbolic link)的 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

最佳答案

这与 PhpStorm 无关。您只需要配置一个whitelist为您的项目。

关于magento - PHPStorm 从覆盖百分比中排除测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30891018/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com