Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Last active August 20, 2016 06:16
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tommcfarlin/593bdb3df4c2e319398bb13024f8e21a to your computer and use it in GitHub Desktop.
[WordPress] Unit Testing with Pressmatic

Unit Testing with Pressmatic

  • Updated 2 August 2016

Installing Composer on Pressmatic

  1. SSH into the Pressmatic box
  2. $ apt-get update
  3. $ apt-get install curl php5-cli git
  4. $ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Installing PHPUnit with Composer

  1. $ composer global require "phpunit/phpunit=4.8.*”
  2. $ export PATH="$PATH:$HOME/.composer/vendor/bin"

Setting Up Plugin Unit Tests

1. Generate the Plugin Test Files

$ wp scaffold plugin-tests acme-plugin

2. Initialize the Environment Locally

$ cd $(wp plugin path acme-plugin --dir) $ bash bin/install-wp-tests.sh wordpress_test root root localhost latest

3. Run the Plugin Tests

$ phpunit

More Information

Read more informaton about this gist in this post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment