Negative Margins Adventures in css, javascript, and all things web

2May/101

Automatically run phpunit tests with Kicker on OS X

Here's a quick tutorial on how to use Kicker to automatically run PHPUnit tests on OS X. Kicker uses OS X's filesystem events to automatically run a command after a target directory or file is changed. Better yet, after the command is run it will Growl the results for you!

  1. First, install Kicker: sudo gem install kicker
  2. Next, switch to your tests directory
  3. kicker -e "phpunit Bundle/SomeBundle" Bundle/SomeBundle/ ../src/Bundle/SomeBundle/

The Kicker command structure is the command to be executed, followed by the directories or files to be watched. In my example, the tests in the SomeBundle directory are run and if any file in the test directory or the src directory are changed the tests are run. When phpunit finishes running a growl notification will be made. Using the Growl control panel, you can change the types of growls that are produced on either successful or failed tests. I like the Music Video display style.

Special thanks to my coworker Justin for pointing this out.