我最近通过 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/