Wednesday, 6 August 2008

PHPUnit - installation on OS X under XAMPP

Just a couple of notes on installing PHPUnit under XAMPP for OS X.

Check that pear is in the PATH

sh-3.2# echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Applications/xampp/xamppfiles/bin



If pear is absent from the PATH, it can be made available by editing /etc/bashrc using vi to add the following lines:

PATH=$PATH:/Applications/xampp/xamppfiles/bin
export PATH



If you're behind a proxy then you'll need to configure pear using something like the following:

pear config-set http_proxy wwwcache.whereveryouare.ac.uk:3128



PHPUnit can then be installed by running the following commands:

pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit



If necessary, the memory_limit setting in /Applications/xampp/xamppfiles/etc/php.ini can be increased to avoid "Fatal error: Allowed memory size of 8388608 bytes exhausted (tried..." message during installation of PHPUnit

The following message might then be seen when trying to run PHPUnit from the command line:

$ phpunit
Warning: require_once(PHPUnit/Util/Filter.php): failed to open stream: Not a directory in /Applications/xampp/xamppfiles/bin/phpunit on line 40.......



This can be fixed by opening up /Applications/xampp/xamppfiles/etc/php.ini and amending the include_path line added by pear so it looks as follows:

;***** Added by go-pear
include_path=".:/Applications/xampp/xamppfiles/lib/php:/Applications/xampp/xamppfiles/lib/php/pear"
;*****



No comments: