- Updated 20 August 2016
- SSH into the Pressmatic box
$ apt-get update
$ apt-get install curl php5-cli git subversion
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
$ composer global require "phpunit/phpunit=4.8.*”
$ export PATH="$PATH:$HOME/.composer/vendor/bin"
$ wp scaffold plugin-tests <plugin-name>
$ cd $(wp plugin path <plugin-name> --dir)
$ bash bin/install-wp-tests.sh wordpress_test root root localhost latest
$ phpunit
Running phpunit
could result in a fatal error stating that some core WordPress files in /tmp directory were not found.
It probably means that the bash bin/install-wp-tests.sh wordpress_test root root localhost latest
command failed and you might have to delete the "wordpress-test" database as well as /tmp/wordpress
and /tmp/wordpress-tests-lib
directories and re-run the bash bin/install-wp-tests.sh wordpress_test root root localhost latest
command again.
Read more informaton about this gist in this post.