phpunit require_once() 错误

标签 php installation phpunit filepath php-ini

我最近通过 pear 安装程序在我的服务器上安装了 phpunit。

当我去运行测试时,我收到以下错误:

PHP Warning: require_once(PHPUnit/Util/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 44

PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Util/Filter.php' (include_path='.:/usr/bin/php') in /usr/bin/phpunit on line 44

在进行了一些搜索之后,我尝试对服务器上我的 php.ini 文件中的 include_path 进行一些修改。但这并没有起到任何作用。

知道是什么原因造成的吗?

最佳答案

更新:截至 2013 年 11 月和 Ubuntu 12.04,这两个命令应该足够了:

sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit

以下是较旧的答案。 这是一个已知问题,尽管已经过去了将近一年半。在这里阅读它

The code coverage must be installed in order for phpunit to work properly

这里介绍了您需要做的事情:

code coverage installation through PEAR

基本上你必须输入(如果你没有权限,使用 sudo,假设 phpunit 已经安装):

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear install phpunit/PHP_CodeCoverage

关于phpunit require_once() 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1528717/

相关文章:

android - 从 aerogear 统一推送服务器注销 android 客户端

php - 在函数中模拟 Propel 查询 (Symfony2)

selenium - 无法访问 PHPUnit Coverage 中的 PHPUNIT_SELENIUM_TEST_ID cookie

javascript - 优化重定向代码

php - 将 C(\0 终止)字符串转换为 PHP 字符串

javascript - 使用ajax将时间以秒为单位传递给div

android - 同时安装稳定版和开发版应用程序的实用方法是什么?

windows - 使用 Inno Setup 安装时应用程序不工作

php - 是否可以在 php 中实例化一个函数?

php - 在快完成时开始使用单元测试是否现实?