WordPress Unit Tests using MAMP Pro
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:
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 your
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
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
ini_set( 'memory_limit', '256M' );
- Add this to your
export WP_TESTS_DIR=~/svn/wp-dev/trunk/tests/phpunit/(adjust path as appropriate).
which phpunit— if the answer is
/usr/bin/phpunitor similar, then you messed up the
PATH. Make sure that the MAMP paths are first. You should get an answer like: