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?
I had the same issue with Windows 8 Similar to the top answer, I needed to start the command line, however make sure to run cmd.exe as administrator. Then the two commands
UPDATE: As of 2013 November and Ubuntu 12.04 these 2 commands should suffice:
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):
Ubuntu 12.04:
In my case, I solved it by adding
/usr/share/php/PEAR
to theinclude_path
.I'm using Ubuntu 10.04.2.
My original problem was I could not get the command line version of php (yum install php or yum install php-cli) to upgrade to => php5.2.7 I was stuck on 5.1 version
I had already compiled php 5.3.3 for use with apache. So I setup a symbolic link from /usr/bin/php (the command line default) to my compiled version in /var/php5/bin/php to get the command line php reporting 5.3.3
Then I refollowed the pear install steps for phpunit
But it still needed the code coverage stuff when I ran phpunit.
So I hunted code coverage down under /var/php5/lib/php/PHP/CodeCoverage and added that to the include path in php.ini include_path=".:/var/php5/lib/php/"
Make sure to add it to the include path without /PHP because phpunit starts at PHP/ (notice caps) looking for Code Coverage Failed opening required 'PHP/CodeCoverage/Filter.php'
For me dividing test's in multiple batches helped.