-
-
Notifications
You must be signed in to change notification settings - Fork 514
Unit testing
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:
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.
- 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/
- Navigate into the
www
directory and clone Timber...
$ cd ~/vagrant-local/www/
$ git clone [email protected]:jarednova/timber.git
- Now install the necessary Composer files...
$ cd timber
$ composer install
- 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...
$ 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.
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.