“Fatal error: Call to undefined method PHPUnit_Util_Filter::addfiletofilter() in /usr/bin/phpunit on line 48”

杀马特。学长 韩版系。学妹 提交于 2019-12-02 19:09:55

问题


I have just installed phpunit using PEAR on our Ubuntu/Linux server ( Linux mccoy 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:45:36 UTC 2009 x86_64 GNU/Linux )

when I try to run a unit test I get the error:

"Fatal error: Call to undefined method PHPUnit_Util_Filter::addfiletofilter() in /usr/bin/phpunit on line 48"

I have googled this and came across a few threads on it however none of these seem to fix my issue.

I have added the following line to my

/etc/php5/cli/php.ini:

include_path = ".:/usr/share/php/PHPUnit"

(I've also tried it without the "/PHPUnit" folder included)

But I still get this error.

Any help would be greatly appreciated

gvanto

edit: this is what is in start of file /user/bin/phpunit:

// ...just comments prior to this

 if (extension_loaded('xdebug')) {
     xdebug_disable(); }

 if (strpos('/usr/bin/php', '@php_bin') === 0) {
     set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); }

 require_once 'PHPUnit/Util/Filter.php';

 PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT'); //line 48

 require 'PHPUnit/TextUI/Command.php';

 define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');

回答1:


Seems like a version conflict / installation issue.

pear version should produce 1.9.4.. If not pear upgrade and follow the commands until it does.

Then sudo pear install --force --alldeps phpunit/phpunit to fix the installation.+

Your include path should include the "pear" dir. Use pear config-show to find that.



来源:https://stackoverflow.com/questions/12241183/fatal-error-call-to-undefined-method-phpunit-util-filteraddfiletofilter-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!