Does anyone know how to install PHPUnit on Mac OS X (I'm using XAMPP). I tried the following commands and it said installation succeeded (no errors). Now, when I try to run a phpunit command in Terminal, I get an error that the command phpunit could not be found. Also, running "which phpunit" returns nothing.
The commands I ran:
$sudo /Applications/XAMPP/xamppfiles/bin/pear channel-discover pear.phpunit.de
$sudo /Applications/XAMPP/xamppfiles/bin/pear channel-discover pear.symfony-project.com
$sudo /Applications/XAMPP/xamppfiles/bin/pear channel-discover components.ez.no
$sudo /Applications/XAMPP/xamppfiles/bin/pear install -a phpunit/PHPUnit
Thanks.
Installing PHPunit through XAMPP almost drove me mad, an error was telling me that my xdebug version was to old to install the Coverage lib required for PHPunit, three seconds later another was telling me that everything was fine but no phpunit command was installed.
I've chosen to bypass that problem by installing phpunit at system level (outside of XAMPP).
cd /tmp
curl http://pear.php.net/go-pear.phar > go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
This should install pear (and tell you where, default is in your home).
cd ~/pear/bin
sudo ./pear channel-discover pear.phpunit.de
sudo ./pear channel-discover pear.symfony-project.com
sudo ./pear channel-discover components.ez.no
sudo ./pear install -a phpunit/PHPUnit
./phpunit should now return you something (in my case it's displaying that some import where unmet.
Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in ~/pear/share/pear/PHPUnit/Autoload.php on line 45
Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:') in ~/pear/share/pear/PHPUnit/Autoload.php on line 45
If you don't have a /etc/php.ini, create it:
sudo cp /etc/php.ini.default /etc/php.ini
Then edit /etc/php.ini and set the right path:
include_path = ".:/php/includes:/Users/YOURUSERNAME/pear/share/pear"
Then calling ./phpunit in your pear bin directory should work... It's quite a pain comparing to a few aptitude and pear call on Ubuntu, but it let you work on OSX. You should be able to still use XAMPP as a webserver but remember that XAMPP uses its buildin PHP environment, phpunit will use the one of your system.
AsTeR's method worked for me though because being stuck with old PHP 5.3.1 current PHPUnit versions will complain because function stream_resolve_include_path is missing.
So I ended up used the solution together with this answer: https://stackoverflow.com/a/8249291
I did as #trent-scott did and got same error.
Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:')
As you can notice there is an empty include path (include_path='.:')..
Go to your php.ini file. Figure out which by doing this in terminal 'php --ini'.
Make sure you've got something similar to this somewhere in the file (be sure to replace username):
include_path=".:/Users/hfossli/pear/share/pear"
It should be sufficient, but I for some reason got this (be sure to replace username):
include_path=".:/Applications/XAMPP/xamppfiles/lib/php/pear:/Applications/XAMPP/xamppfiles/lib/php/pear:/Users/hfossli/pear/share/pear"
I fund an other temporary solution that worked for me. Instead of using the pear command directly within your Xampp app, try using the full path to pear executable like : /Applications/XAMPP/xamppfiles/bin/pear
hope it helped.
Related
I am using wamp 2.2 in win 7 and trying to install phpunit
1.I downoad phpunit-master.zip from https://github.com/sebastianbergmann/phpunit.
2. I unzip it.
3. I put it under D:\wamp\bin\php\php5.3.10, Then, I run below php script;
<?php
//testsuite.wordcount.php
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once "PHPUnit/Framework/TestSuite.php";
require_once "class.testwordcount.php";
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTestSuite("TestWordCount");
PHPUnit_TextUI_TestRunner::run($suite);
?>
The output is:
*Warning: require_once(PHPUnit/TextUI/TestRunner.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\oop\test.php on line 4*
It seems that I did not install phpunit correctly, so what may go wrong?
Run the following commands (they may take a while to update):
pear channel-update pear.php.net
pear upgrade-all
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear update-channels
To install PHPUnit, run
pear install --alldeps --force phpunit/PHPUnit
To test that PHPUnit was successfully installed, run
phpunit -v
You can't just plop the files there and hope for it to work, you need to follow the installation instructions here: https://github.com/sebastianbergmann/phpunit#installation
For me, the easiest way I've found to install it is via Pear if you're happy to have it installed system wide, although this can get messy down the track with upgrades, different versions etc, or on a per project basis you can install via composer (which is my preference)
I've upgraded to Mountain Lion and installed php5.4 which took a bit of tweaking Mountain Lion change php location
My next issue is if I run pear -v or pecl -v these return
Could not open input file: /usr/lib/php/pear/pearcmd.php
Could not open input file: /usr/lib/php/pear/peclcmd.php
Do I need to change pear and pecl to point to my new php which is installed in /usr/local/php5/bin/
If so how do I do this and will I lose all of my previously installed extensions such as phpunit?
Thanks
I sorted this by installing pear again. After downloading go-pear.phar then running
sudo php -d detect_unicode=0 go-pear.phar
In the install there are options to change directories pear is using. They were already set to the correct locations for my new php such as /usr/local/php5/bin
I then had to add that path to my bash_profile for the pear command to be recognised.
export PATH=$PATH:/usr/local/php5/bin
To get pecl working again I removed pecl from /usr/bin then symlinked to the pecl in /usr/local/php5/bin
sudo ln -s /usr/local/php5/bin/pecl /usr/bin/pecl
The first package I tried to install was APC and I got the error
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
This was sorted by following instructions from phpize won't work on Mac OS X Lion I used the homebrew solution
UPDATE: I installed PHPUnit fine then ran phpunit --version
This gave an error of
PHP Warning: require(/usr/lib/php/pear/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
Running which phpunit returned /usr/bin/phpunit
Solved by more symlinking
sudo ln -s /usr/local/php5/bin/phpunit phpunit
On Mavericks there's a file in /usr/lib/php called install-pear-nozlib.phar
Everything worked by just running
sudo php install-pear-nozlib.phar from that directory. And then adding /usr/lib/php/pear to the include path in php.ini
Hope that helps someone
I have this issue with one of my users on my Mac. It works fine with the other. So I guess it could have something to do with installing pear using the other user (as that's what I did).
I have no solution to this, but you could try to install pear again and try to select to install it to system instead of local and see if that works.
Edit: I tried to do this, however pear started to work, but not pecl.
i'm working with ubuntu 11.10 as root on my local machine, i've installed xampp 1.7.7 and i'm a newbie to ubuntu,
while following a tutorial on sitepoint(http://www.sitepoint.com/getting-started-with-pear/) on how to install pear to use PhpUnit, i didnt notice it then, but it seems that i installed or used an existing php version 5.3.6 in CL to do that, also the pear installation was built on this version, while xampp being installed,i now have two versions of php,xampp's 5.3.8 and the 5.3.6, anyway, what i want to do is to use the existing xampp php version and build pear on that, to make all my work through xampp.so my questions are:
how to uninstall the php V5.3.6 and it's pear installation?
how to link the CL with the php ver. of xampp?
how to build the next pear installation on the php ver. of xampp?
i want all my web dev. work through xampp, is there anything else i need to unistall, to avoid this confusion? 4.
i did the following in attampet to solve the problem:
i wrote this in bash:
gedit ~/.bashrc
i added that to the end of ~/.bashrc file in attempt to change environment path:
export PATH=/opt/lampp/bin:$PATH
export PATH=/opt/lampp/lib/php:$PATH
export PATH=/opt/lampp/lib/php/PHPUnit/pearcmd.php:$PATH
i checked the php and pear version using 'php -v' and 'pear list'
i got an ouput of:
PHP 5.3.8 (cli) (built: Sep 19 2011 13:29:27)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
and for pear:
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.9 stable
Console_Getopt 1.3.1 stable
PEAR 1.9.4 stable
PHPUnit 1.3.2 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.1 stable
when i run: 'phpunit MessageTest.php': i get
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/php/includes:/opt/lampp/lib/php:/opt/lampp/bin:/opt/lampp/lib/php/PEAR') in /usr/bin/phpunit on line 38
5.i ran the following commands as reported in other questions as a solution to that error:
sudo apt-get remove phpunit
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit
sudo apt-get install phpunit
and updated include path of php.ini to be:
include_path = ".:/php/includes:/opt/lampp/lib/php:/opt/lampp/bin:/opt/lampp/lib/php/PEAR"
the php file MessageTest.php:
<?php
require 'PHPUnit/Autoload.php';
$path = '/opt/lampp/lib/php/PEAR';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Message/Controller/MessageController.php';
class MessageTest extends PHPUnit_Framework_TestCase{
private $message;
public function setUp() {
$this->message = new MessageController();
}
public function tearDown() {
}
public function testRepeat(){
$yell = "Hello, Any One Out There?";
$this->message->repeat($yell); //sending a request
$returnedMessage = $this->message->repeat($yell);//get a response
$this->assertEquals($returnedMessage, $yell);
}
}
?>
MessageController class from MessageController.php that i'm trying to test
<?php
class MessageController {
public function actionHelloWorld() {
echo 'helloWorld';
}
public function repeat($inputString){
return $inputString;
}
}
$msg = new MessageController;
?>
I'm not using any PHP framework, i just made the files and classes sounds like it that's all.
and still i get the same error:
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line
Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/php/includes:/opt/lampp/lib/php:/opt/lampp/bin:/opt/lampp/lib/php/PEAR') in /usr/bin/phpunit on line 38
sure, i'm getting demanding here, i've wasted a lot of time and got really frustrated over this, hope you guys dont get bored reading through my questions, i appreciate your help
thanks in advance,
Mohamad elbialy
Finally, i got the answer for the question on how to link the xampp's php and pear to CL (bash shell for ubuntu),
type the following in a terminal window:
gedit ~/.bashrc
the file opens and you add the following to the end of file:
export PATH=/opt/lampp/bin:$PATH
and to make sure type the following in the terminal:
echo $PATH
you'll see '/opt/lampp/bin' in the echoed path along with others added by default
this is the only way that worked for me after 2-3 days of searching forums, other stackoverflow and superuser questions
to check that the CL is dealing with xampp's php and pear version, type the following:
php -v shows the version of php
pear list shows the version of pear along with pear dependent packages
Now, i've been doing this to make PHPunit work in CL, for 5 days, imagine the frustration,
being a newbie to Ubuntu i made alot of sudo and not so sudo commands that missed the whole thing for me, so i decided to make a fresh installation of ubuntu (to delete all those pear, php and phpunit packages that i installed and couldnt track thier path)
so starting from a fresh ubuntu 11.10 and xampp 1.7.7, i did the following to make phpunit work:
i made the link for xampp's php and pear with cL (i wrote how above),
type the following steps in CL:
sudo /opt/lampp/bin/pear uninstall phpunit (xampp's is 1.2.something, i want to install 3.6.10)
sudo /opt/lampp/bin/pear list (PHPunit is not there, that's a check),
the following steps as advised in PHPunit manual1
sudo /opt/lampp/bin/pear config-set auto_discover 1 (opens the download channel or something)
sudo /opt/lampp/bin/pear install pear.phpunit.de/PHPUnit (this installs ver. 3.6.10),
now type in CL:
sudo /opt/lampp/bin/phpunit --version (this shows the version of 3.6.10, yes you've made it)
i used /opt/lampp/bin/phpunit, to make you see quick results and no, you dont need to include anything in path to work, you already done that, you need to close that terminal and open a new one and type only, phpunit --version, you'll get the same result, it's there, it's all yours
Note:
i used '/opt/lampp/bin/something and then the command', to force my installations through xampp's php and pear, this is not needed (cause you set the environment path), but that's how you get to do things when you spend more than 5 days of search.
i tried working with phpunit 1.2.something of xampp's, but it seems that it's not there for the command line, i dont know why and i dont want to, so if that happens to you and you want ver.1.2.something, find all versions, using the instructions in this link (http://pear.phpunit.de/) and do the same steps to install it,
i didnt try the method in that link and if you get stuck you can comment to this answer,
I am using MAMP for development. I have never been able to get PEAR to work. The MAMP documentation and forums seem not to have the answers. Everybody who asked on the MAMP forum seems to have no replies.
Previously I have developed the systems on MAMP and only used PEAR for mail so I got it working once on the server rather than in MAMP. I want to use more of PEAR now.
Can anybody give me an idiots guide to getting it going. I can access terminal and type command lines, however, I don't really understand what's going on so when things stop or throw errors I have to ask more questions. I have had a go with various things found on the internet but failed so far.
MAMP is version 1.9.5 Mac OS 10.6.7
#Marcelo Rodrigo's answer is great! And I'm glad he included his sources. By following sources of his sources I was able to find the information below.
Install PEAR on MAMP
In order to get PEAR working with MAMP run the following commands. Notice there are commands for MAMP v1.x.x and for newer versions. Find out what version you are running. Also, notice that the PHP versions differ. Make sure the version in the commands below is the one you are actually using. MAMP allows you to change versions. You can check by opening MAMP > Server > PHP.
NOTE:
This may be obvious to some, but you should stop MAMP first. Otherwise you might get some strange errors.
1) Change the directory permissions so you can execute files within them:
MAMP v2.x.x
chmod 774 /Applications/MAMP/bin/php/php5.4.4/bin/pear
chmod 774 /Applications/MAMP/bin/php/php5.4.4/bin/php
MAMP v1.x.x
chmod 774 /Applications/MAMP/bin/php5.3/bin/pear
chmod 774 /Applications/MAMP/bin/php5.3/bin/php
2) Setup an alias to avoid typing the whole path.
Every time you want to access pear you have to type "/Applications/MAMP/bin/php5.3/bin/pear". Typing "pear" referes to what is installed on your mac already and not MAMP's install. (This only apply for the current session. For a permanent alias, place the command below in your ~/.bash_profile file. Here is a tutorial on how to do that.)
MAMP v2.x.x
alias mpear="/Applications/MAMP/bin/php/php5.4.4/bin/pear"
MAMP v1.x.x
alias mpear="/Applications/MAMP/bin/php5.3/bin/pear"
3) Make a link between php5 and php5.3 folders (Not Needed for MAMP v2.x.x):
Pear gets confused about its version because it installs in both php5.3 and php5 directory
When you upgrade pear it will create a new /Application/MAMP/bin/php5 directory and spread files between php5.3 and php5 folders. Use the code below to make a link between the two file so they act as one. More info about "ln" command. Source: #Marcelo Rodrigo's post
ln -s php5.3 php5
4) Check to make sure pear is working:
mpear -V
5) Now upgrade pear:
mpear channel-update pear.php.net
mpear upgrade pear
6) And check again to see if it upgraded pear correctly
mpear -V
Install PHPUnit
You do not need to install PHPUnit. If mpear -V worked for you, then you are done installing PEAR on MAMP. For my development environment I needed PHPUnit for unit testing, so I figured I would include a tutorial to install PHPUnit now that we have PEAR working. Only do this if you need PHPUnit. If you don't know what it is, you don't need it.
Run the following commands:
1) Install PHPUnit:
NOTE: Below I am using "mpear" which is actually an alias I setup in step 2 above. You could simply use "/Applications/MAMP/bin/php5.3/bin/pear" in its place.
mpear config-set auto_discover 1
mpear install pear.phpunit.de/PHPUnit
Source: http://www.phpunit.de/manual/current/en/installation.html
2) Allow MAMP to use PHPUnit
Link your MAMP's install of phpunit with the default phpunit location. (Doesn't work with Mountain Lion, instead see step 2a)
sudo ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
**2a) For Mountain Lion Only - Create a symobolic link between MAMP's php.ini and the php.ini in /etc
sudo ln -s /Applications/MAMP/bin/php/php5.4.4/conf/php.ini /etc/php.ini
If it says files exists, make a backup of /etc/php.ini and delete it.
3) Make sure it works
phpunit --version
For details about installing phpunit check out:
http://jeffreybarke.net/2010/08/how-to-install-phpunit-with-mamp/
http://www.phpunit.de/manual/current/en/installation.html
http://d.hatena.ne.jp/Kenji_s/20120117/1326763908
Sources:
http://jeffreybarke.net/2010/08/how-to-install-phpunit-with-mamp/
http://forum.mamp.info/viewtopic.php?f=2&t=8465#p20375
#Marcelo Rodrigo's Answer
If you just want phpunit to work, use the following commands on a fresh copy of MAMP 1.9.5:
cd /Applications/MAMP/bin
ln -s php5.3 php5
php5/bin/pear channel-discover pear.phpunit.de
php5/bin/pear channel-discover components.ez.no
php5/bin/pear channel-discover pear.symfony-project.com
php5/bin/pear channel-update pear.php.net
php5/bin/pear upgrade pear
php5/bin/pear install phpunit/PHPUnit
ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
phpunit --version
Done.
The above code fixes the following issues:
Bug 1:
pear gets confused about its version because it installs in both php5.3 and php5 directory
Pear updates upgrades and installs from /Applications/MAMP/bin/php5.3/pear, but it will create a new /Application/MAMP/bin/php5 directory and spread files between the php5.3 direct and the new php5 directory and get very confused about what version it is.
Fix:
ln -s php5.3 php5
I think that if you are using PHP 5.2 then using ln -s php5.2 php5 should work equally well but I haven't tested this
Issue 2:
pear is out of date
this is understandable of the MAMP team, the problem really was that it was difficult to do a upgrade because of Bug 1
Source: http://forum.mamp.info/viewtopic.php?f=6&t=11102
I recently found the following link correctly setup my MAMP 2.1.1 running:
PEAR Version: 1.9.4
PHP Version: 5.4.4
Zend Engine Version: 2.4.0
Try:
sudo /Applications/MAMP/bin/php/php5.4.4/bin/pear config-set auto_discover 1
sudo /Applications/MAMP/bin/php/php5.4.4/bin/pear install pear.phpunit.de/PHPUnit
To make it available on the command line everywhere you need to create a soft-line to phpunit in your local bin.
sudo ln -s /Applications/MAMP/bin/php/php5.4.4/bin/phpunit /usr/local/bin/phpunit
Now try:
phpunit --version
Confirm it works try it from here: /Applications/MAMP/bin/php/php5.4.4/bin/
Confirm the symlink worked. Try it somewhere else like ~/ or /.
If they both worked you are ready to code.
SOURCE/CREDIT: Enej Bajgoric Web Developer, CTLT UBC Vancouver Canada at http://blogs.ubc.ca/enej/2012/10/01/installing-phpunit-on-mamps/
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
I had this problem on OS X. Fixed it with the following commands which force all the php dependencies to be reinstalled, which included a couple of packages from other channels that were not already configured:
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear install --alldeps phpunit/PHPUnit
https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544
and specially this comment for ubuntu 11.04 and may be for some others too
even though i did ths steps as recommended above, i didn't get it to work but after i upgraded pear from 1.9.1 to 1.9.2 it's working perfectly just do this
speshu#speshu-laptop:~$ sudo pear upgrade pear
downloading PEAR-1.9.2.tgz ...
Starting to download PEAR-1.9.2.tgz (295,120 bytes)
.....................................................done: 295,120 bytes
upgrade ok: channel://pear.php.net/PEAR-1.9.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
If it is the first time you are using PEAR, perhaps you have not configured the include path right. Take a look at the appropriate section in the PEAR manual.
https://github.com/sebastianbergmann/php-code-coverage
sb#ubuntu ~ % pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
sb#ubuntu ~ % pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded
sb#vmware ~ % pear install phpunit/PHP_CodeCoverage
downloading PHP_CodeCoverage-0.9.0.tgz ...
Starting to download PHP_CodeCoverage-0.9.0.tgz (108,376 bytes)
.........................done: 108,376 bytes
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-0.9.0
(include_path='.:/usr/bin/php')
Are you sure you added it to the include_path?
It might also help if we saw your ini file, and the include_path snippet in it...
I found it!
Looks like PEAR installed PHPUnit in /usr/share/pear. Not sure why but that's where it is. Must be a (mt) thing.
Anyway, I'm all set. Thanks for the help.
This is also what happens if you have an out-of-date or incomplete PHPUnit install. Please be aware that after you set up PEAR, you must add the PHPUnit.de channel in order to get an up-to-date package.
In my case, I solved it by adding /usr/share/php/PEAR to the include_path.
I'm using Ubuntu 10.04.2.
If you have problems with accessing components try another way.
Install pear
sudo apt-get install php-pear
Install phpunit by using pear.
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
Install phpunit/Selenium, but first you need to install curl module
sudo apt-get install php5-curl
pear install phpunit/PHPUnit_Selenium
I was having the same problem. Netbeans was reporting that the phpunit version was too old (which it wasn't). Running the phpunit script directly showed the above messages.
I solved it adding:
include_path=".:/usr/share/php"
To /etc/php5/cli/php.ini
Please NOTE that the php.ini file is the one for php CLI (command) not the php.ini used for apache!
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'
I had this problem . I was developing a zend framework site. Finally I manage to solve it by removing the zend installation and removing/commenting the include path in bath php.ini files in apache and cli. To develop site with zend we don't need to have zend installed. Insted we can copy the library to our site folder
For me dividing test's in multiple batches helped.
You can solve this issue by redefining the environment variables in PEAR.
This is how I solved the problem and I used Ubuntu 12.10
http://rkrants.blogspot.in/2013/01/installing-phpunitpear-in-ubuntu-1210.html
In short it defines the paths and then reinstalls phpunit
Ubuntu 12.04:
sudo pear channel-discover pear.symfony.com
sudo pear install --alldeps phpunit/PHPUnit
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
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit