2015-10-15 81 views
4

我使用Codeigniter3框架和phpunit包ci-phpunit-test。 我在启用zend调试器的zend服务器上运行php。使用Jetbrains覆盖PHPUnit 0%PHPStorm

我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%的覆盖率(我确信测试会通过很多代码)。

这里是我所得到的:

enter image description here

UPDATE:一些更多的信息.​​.. 当我加入这个在phpunit.xml文件,它告诉我没有启用Xdebug的:

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

因此,我试图启用xdebug调试器,测试veeeeeery运行速度慢,我得到了建设/覆盖率文件夹中的HTML报告。这很好,但没有集成到PHPStorm环境中。

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

+0

@craig_h是的,我敢肯定,我得到的测试与全部通过测试报告(我也可以调试到它们) –

+0

@craig_h我有“显示选项”检查和“激活行业评级”检查 –

+0

@craig_h添加'/ ** @ test ** /'不会改变任何东西 –

回答

1

我有同样的问题,并且这个answer做了伎俩。

通过将项目根改为绝对路径(/ media/hdd/...)我能够解决问题。

+0

我有同样的问题,它为我工作。我在一个包含符号链接的路径后打开了项目,所以我的项目根目录中有一个符号链接。当我使用已解析的符号链接打开项目时,代码覆盖率已运行。 – Pitt