Skip to content
Jared Novack edited this page Aug 14, 2017 · 10 revisions

Tests are available for a growing number of methods. I've found PHPUnit to be a pain in the ass to get running with MAMP (at least on OSX Mavericks). Here are the steps for Vagrant + Mac OS Sierra:

Setup VVV

Follow the setup steps for Varying Vagrant Vagrants. If you're having trouble I recommend starting 100% fresh (uninstall and delete everything including VirtualBox). For this walk-through I'm going to start from scratch.

  1. Install VVV Follow the setup instructions — don't forget to install VirtualBox and Vagrant first! For this tutorial I'm going to assume you've installed into ~/vagrant-local/

Setting up Timber for Tests

  1. Navigate into the www directory and clone Timber...
$ cd ~/vagrant-local/www/
$ git clone [email protected]:jarednova/timber.git
  1. Now install the necessary Composer files...
$ cd timber
$ composer install
  1. Ok, you should be ready to run tests. This is where things get interesting. You're going to login to your Vagrant virtual box to run the tests...
Login to Vagrant
$ vagrant ssh

Now wait for it to bring you into the virtual box, from the virtual environment...

$ cd /srv/www/timber
$ phpunit

You should see a bunch of gobbledygook across your screen (the whole process will take about 3 mins.); but we should see that WordPress is testing successfully. Hurrah! For more info, check out the Codex docs on Automated Testing.

Writing tests

Now we get to the good stuff. You can add tests to the timber/tests directory. Any new features should be covered by tests. You can be a hero and help write tests for existing methods and functionality.

Clone this wiki locally