phpunit – 错误的路径

有人知道我做错了什么吗?

我安装了phpunit,当我在/ opt / local / PEAR目录下时一切都很好,所以如果我去/ opt / local / PEAR目录并运行phpunit,我会得到:

PHPUnit 3.5.11 by Sebastian Bergmann.

Usage: phpunit [switches] UnitTest [UnitTest.php]

phpunit [switches]

blablabla

但如果我在另一条路上,我会得到:

Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/local/bin/phpunit on line 38 
Fatal error: require_once(): Failed opening required ‘PHP/CodeCoverage/Filter.php’ (include_path=’.:/usr/lib/php’) in /usr/local/bin/phpunit on line 38

我知道我的PATH有问题.我该如何解决?

尝试将/ opt / local / PEAR添加到php.ini文件include_path.

//Before:
include_path='.:/usr/lib/php'
//After:
include_path='.:/usr/lib/php:/opt/local/PEAR'

您可能还需要重新启动Web服务器才能使更改生效.

正如RobertPitt评论的那样,这也可以在运行时完成而无需访问php.ini文件.

<?php
$path = '/opt/local/PEAR';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
?>

翻译自:https://stackoverflow.com/questions/5022894/phpunit-wrong-path

我来评几句
登录后评论

已发表评论数()

相关站点

+订阅
热门文章