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.baksource ~/.profile(or where ever you made yourPATHchanges)sudo pear update-channels && sudo pear upgrade pearsudo pear config-set auto_discover 1sudo pear install pear.phpunit.de/PHPUnit- Make an SVN checkout of
http://develop.svn.wordpress.org/ - Copy
wp-tests-config-sample.phptowp-tests-config.php - Edit
wp-tests-config.phpand 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/phpunitor 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.