问题描述
当我在PHPstorm中运行测试套件时,所有代码的覆盖率都返回0%(我知道这是不正确的),而当我从命令行运行PHPunit时,记录的HTML输出文档显示我实际上一定要覆盖并列出所有详细信息.
When I run my test suite in PHPstorm, the code coverage comes back with 0% for everything (which I know is not true), and when I run PHPunit from the command line, the logged HTML output documents show that I actually DO have coverage and lists all the detailed information.
在PHPstorm中,我将我的PHP解释器设置为/usr/local/bin/php(PHP 5.6.7)和xdebug 2.3.2(屏幕截图: https://dl.dropboxusercontent.com/u/379071/Screen%20Shot%202015- 04-20%20at%206.57.39%20 PM.png ).在我的PHPunit首选项中,我将脚本路径"设置为我的作曲家autoload.php文件.在我的运行时配置中,我将PHPunit运行时设置为与定义的配置文件"一起运行(请参见下文).当我运行时,所有测试都会运行并通过(失败显示堆栈跟踪),但是所有代码的覆盖率完全为零.
In PHPstorm, I have my PHP interpreter set to /usr/local/bin/php (PHP 5.6.7) and xdebug 2.3.2 (screenshot: https://dl.dropboxusercontent.com/u/379071/Screen%20Shot%202015-04-20%20at%206.57.39%20PM.png). In my PHPunit preferences, I have the 'path to script' set to my composer autoload.php file. In my runtime configuration, I have a PHPunit runtime set to run with a 'defined configuration file' (See below). When I run, all the tests run and pass (a failure shows a stack trace), but the code coverage is completely zero for everything.
任何帮助将不胜感激.我确定我只是错过了一些东西.
Any help would be greatly appreciated. I'm sure I've just missed something.
我的XML配置文件的内容:
Contents of my XML configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/bootstrap.php"
colors="true">
<testsuites>
<testsuite>
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/codeCoverage" charset="UTF-8"
yui="true" highlight="true"
lowUpperBound="50" highLowerBound="80"/>
<log type="testdox-html" target="./log/testdox.html"/>
</logging>
</phpunit>
推荐答案
我知道这是一个旧线程,但我刚遇到此问题.在我的情况下,项目路径包含指向其他hd的符号链接.通过将项目根目录更改为绝对路径(/media/hdd/...),我得以解决该问题.
I know this is an old thread but I just encountered this issue. In my case the project path contained a symlink to a different hd. By changing the project root to the absolute path (/media/hdd/...) I was able to resolve the problem.
这篇关于PHPstorm PHPunit代码合作覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!