Note: Work in progress document.
Note: Change the PHP version number as appropriate to your MAMP Pro install.
- Add the following you your
PATH
, making sure that it is first:/Applications/MAMP/bin/php/php5\.3\.6/bin:/Applications/MAMP/bin/apache2/bin:/Applications/MAMP/bin
mv /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf.bak
source ~/.profile
(or where ever you made yourPATH
changes)sudo pear update-channels && sudo pear upgrade pear
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
- Make an SVN checkout of
http://develop.svn.wordpress.org/
- Copy
wp-tests-config-sample.php
towp-tests-config.php
- Edit
wp-tests-config.php
and give it a fresh database. Repeat, a database with nothing else in it. The unit tests will drop every table in the database, so don't be stupid and give it access to a database that has anything else in it. - (OPTIONAL) Increase the memory limit in
wp-config.php
:ini_set( 'memory_limit', '256M' );
- Add this to your
~/.profile
(or equivalent):export WP_TESTS_DIR=~/svn/wp-dev/trunk/tests/phpunit/
(adjust path as appropriate).
You're set!
- Run
which phpunit
— if the answer is/usr/bin/phpunit
or similar, then you messed up thePATH
. Make sure that the MAMP paths are first. You should get an answer like:/Applications/MAMP/bin/php/php5.3.6/bin/phpunit
.
pear installation for PHPUnit no longer works.