The problem I had
When I had initially installed PEAR I just used it’s suggested paths and didn’t think it would be any problem. I could install phpunit and use it from the command line. But when I wanted to configure NetBeans to use PHPUnit I got the following error:
Selected PHPUnit (version ?.?.?) is too old, upgrade it if possible (the
minimum version in 3.3.0).
After reading some posts, trying to fix it through editing all the php.ini’s,
reinstalling PHPUnit, … I still kept on getting errors. Finally I decided to
take the time to restart from scratch and make sure all php related stuff would
be kept in the MAMP directories so that in the future problems like this would
be easier to solve. I removed the old php, phpunit, pear, … binaries from
/usr/local/bin
and replaced them by symlinks to the ones in the MAMP directory.
This tutorials shows how I installed PEAR and PHPUnit from scratch.
Installing PEAR for MAMP
1 2 3 |
|
Now pear will suggest a file layout for you, but it will try to put everything in your home directory, while most of it should be in your MAMP folder. The following is the correct layout:
1 2 3 4 5 6 7 8 9 10 11 |
|
Of course the php5.3/
and username/
could be different for you.
By setting the paths this way all PEAR packages will automatically land inside
the standard PHP include_path
of MAMP.
Now let’s go to /usr/local/bin
and create a symlink to the pear command in
your MAMP directory. This is an easy way to make sure it’s in you PATH
,
allowing you to be able to just type pear
to use it.
1 2 |
|
If you want to you can repeat this for php
, phpunit
and the others too.
Installing PHPUnit
Now that we have PEAR installed installing PHPUnit is easy.
1 2 |
|
Starting from PHPUnit 3.6.8 the functionality behind “phpunit –skeleton-class”
and “phpunit –skeleton-test” is marked as deprecated and it’s going to be
removed in 3.7. So it’s best to install phpunit-skelgen
too:
1
|
|
Having now installed PEAR and PHPUnit properly, you should be able to easily configure NetBeans for use with PHPUnit.