【问题标题】:require_once(PHP/CodeCoverage/Filter.php): failed to open streamrequire_once(PHP/CodeCoverage/Filter.php): 无法打开流
【发布时间】: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


【解决方案1】:

在当前版本的 PHPUnit 中,phpunit 脚本不直接包含 PHP/CodeCoverage/Filter.php。看来您使用的是过时版本的 PHPUnit 和/或混合了 Composer/PEAR 安装。

请按照https://phpunit.de/getting-started.html 上的说明正确安装 PHPUnit。 http://thephp.cc/news/2015/01/phpunit-migration-from-pear-to-phar 解释了如何从基于 PEAR 的安装迁移到 Composer 或 PHAR。

【讨论】:

    猜你喜欢
    • 2014-08-17
    • 1970-01-01
    • 2010-11-14
    • 2017-09-14
    • 2019-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-27
    相关资源
    最近更新 更多