- Install phpunit 6.x
cd /plugin/root/folder wget -O phpunit https://phar.phpunit.de/phpunit-6.phar chmod +x phpunit
- Set environment variables $WP_TESTS_DIR, $WP_CORE_DIR for your installation.
Wordpress core, core-tests and master theme will be copied over to the specified path.
export WP_TESTS_DIR="/var/www/html/testing/core-tests" export WP_CORE_DIR="/var/www/html/testing/core"
- Run install-wp-tests script passing database variables.
Note that a new clean database should be provided as the argument, because database will be cleaned each time a test runs.
$ cd /plugin/root/folder $ bin/install-wp-tests <db-name> <db-user> <db-pass> [db-host] $ bin/install-wp-tests planet4_test planet4 planet4 localhost
- Run phpunit
$ phpunit