phpunit require_once() error

user185305 picture user185305 · Oct 7, 2009 · Viewed 61.1k times · Source

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?

Answer

arunas_t picture arunas_t · May 9, 2011

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