我正在使用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)\Zend\ZendServer\bin\php.exe" -dzend_debugger.enable_coverage=1 C:/Users/NICOLAS/AppData/Local/Temp/ide-phpunit.php --configuration C:\....\phpunit.xml
成功运行所有测试后,Coverage PHPUnit侧栏将打开,仅显示0%的覆盖率(我确信测试会经过大量代码) .
这是我得到的:
UPDATE : some more information... 当我在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%......
1 回答
我遇到了同样的问题,而且answer做了伎俩 .