phpunit require_once()错误 [英] phpunit require_once() error

查看:100
本文介绍了phpunit require_once()错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

当我去运行测试时,出现以下错误:

PHP警告:require_once(PHPUnit/Util/Filter.php):无法打开流:在第44行的/usr/bin/phpunit中没有这样的文件或目录

PHP致命错误:require_once():无法在第44行的/usr/bin/phpunit中打开所需的'PHPUnit/Util/Filter.php'(include_path ='.:/usr/bin/php') >

进行一些搜索后,我尝试对服务器上php.ini文件中的include_path进行一些修改.但这没做任何事情.

任何想法可能是什么原因造成的?

解决方案

更新:自2013年11月和Ubuntu 12.04起,这两个命令就足够了:

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

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

必须安装代码覆盖率才能使phpunit正常工作

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

通过PEAR安装代码覆盖率

基本上,您必须输入(如果没有权限,请使用sudo,因为已经安装了phpunit):

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

I recently installed phpunit on my server via the pear installer.

When I go to run a test I get the following error:

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

After doing some searching, I tried making some modifications to the include_path in my php.ini file on the server. But that hasn't done a thing.

Any idea what might be causing this?

解决方案

UPDATE: As of 2013 November and Ubuntu 12.04 these 2 commands should suffice:

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

The following is an older answer. It's a known problem , although almost a year and a half had passed. Read about it here

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

What you need to do is covered here:

code coverage installation through PEAR

Basically you have to type (with sudo if you don't have permissions, taken that phpunit is already installed):

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

这篇关于phpunit require_once()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆