Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[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 | 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/ 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
You can’t perform that action at this time.