加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

使用Jetbrains PHPStorm覆盖PHPUnit 0%

发布时间:2020-12-13 15:58:33 所属栏目:PHP教程 来源:网络整理
导读:我正在使用Codeigniter3框架和phpunit软件包 ci-phpunit-test. 我在启用了zend调试器的zend服务器上运行php. 我的phpunit.xml文件在那里: phpunit bootstrap="./Bootstrap.php" colors="true" testsuite="CodeIgniter Application Test Suite" testsuites t
我正在使用Codeigniter3框架和phpunit软件包 ci-phpunit-test.
我在启用了zend调试器的zend服务器上运行php.

我的phpunit.xml文件在那里:

<phpunit
    bootstrap="./Bootstrap.php"
    colors="true"
    testsuite="CodeIgniter Application Test Suite">
    <testsuites>
        <testsuite name="CodeIgniter Application Test Suite">
            <directory suffix="test.php">./</directory>
            <exclude>./_ci_phpunit_test/</exclude>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist>
            <directory suffix=".php">../controllers</directory>
            <directory suffix=".php">../models</directory>
        </whitelist>
    </filter>
</phpunit>

我使用带有绿色播放和破折号的图标运行代码覆盖率执行,这将运行以下命令:

"C:Program Files (x86)ZendZendServerbinphp.exe" -dzend_debugger.enable_coverage=1 C:/Users/NICOLAS/AppData/Local/Temp/ide-phpunit.php --configuration C:....phpunit.xml

成功运行所有测试后,Coverage PHPUnit侧栏将打开,仅显示0%的覆盖率(我确信测试会经过大量代码).

这是我得到的:

enter image description here

更新:更多信息……
当我在phpunit.xml文件中添加它时,它告诉我Xdebug未启用:

<logging>
    <log type="coverage-html" target="build/coverage"/>
    <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>

因此,我尝试启用xdebug调试器,测试运行缓慢,我在build / coverage文件夹中获得了HTML报告.它很好但没有集成在PHPStorm环境中.

所以我回到zend调试器并尝试PHPStorm功能(删除phpunit.xml中的日志部分).测试快速运行,但覆盖率保持在0%……

解决方法

我有同样的问题,这 answer做了伎俩.

By changing the project root to the absolute path (/media/hdd/…) I was able to resolve the problem.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读