【发布时间】:2015-03-22 14:55:28
【问题描述】:
我正在尝试熟悉 Symfony 2.3.24/Windows7/PHP 5.4.7 下的测试(单元、功能)。
似乎 PHPUnit 安装正确(通过 Composer),但是当我运行 phpunit -c app/ 命令时,我收到以下错误:
Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in C:\xampp\php\phpunit on line 38
Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\php\phpunit on line 38
我用谷歌搜索了这个问题,但无济于事。我在 PHPUnit 官方网站上还发现了The code coverage report feature requires the Xdebug (2.1.3 or later) and tokenizer extensions。
你对这一切有什么看法?非常感谢您的帮助。
【问题讨论】:
-
检查
php -i(或phpinfo()输出)。是否安装了 PHPUnit 上提到的扩展? (Xdebug 和标记化),它们是否启用? -
@EliasVanOotegem,首先谢谢你。 phpinfo() 页面告诉我们启用了 Tokenizer 支持。但是对于 Xdebug,我在页面上找不到任何信息。我检查了 symfony 分析器页面并且 Xdebug 被禁用。我是否需要取消注释 php.ini 中的特定行?请注意,PHPUnit 的 phpinfo 中没有一行。它应该存在吗?
-
我怀疑你必须自己安装 Xdebug(谷歌会告诉你如何)
-
你说得对,我认为在取消注释 php.ini 上的特定行后启用 Xdebug,但这还不够,因为我还需要将
xdebug.remote_enable的值更改为 1。谢谢非常喜欢。
标签: php symfony testing phpunit composer-php