PHPStorm File Watcher for PHPSpec

Author: Lewis
Wednesday, February 26 2014

Here at Viva IT we’ve been improving some of our processes. One of the new things we’ve discovered, and immediately fallen in love with, is PHPSpec.

For those unfamiliar with PHPSpec, the website describes it as ‘a toolset to drive emergent design by specification’.

Don’t feel put-off by the word ‘specification’, this is not a tool which requires a lot of waterfall-style documentation and formal specifications to be written. In fact, PHPSpec allows extremely rapid test-driven design by letting you describe what your tests do in words, and run tests based off that naturally-described code. This allows for much more intuitive and useful tests, which dramatically reduces the time spent on testing. We were sceptical at first, and if it weren’t for the fact they bribed us with stickers and swag, we never would have tried it. We recommend you take 20 minutes out of your day to try the Prime Factors Kata example, as provided by the wonderful guys over at Inviqua.

The real reason for this post is to not tempt you away from PHPUnit or Codeception, we just really wanted to share a PHPSpec File Watcher we have created for our IDE of choice, PHPStorm. If you don’t know what a file watcher is, it’s a simple process that runs in the background every time you save your file in PHPStorm. They can be used for compiling SASS files, LESS files, and even CoffeeScript compilers; we’re using them to run our tests, so that we can have complete confidence that our code is always doing what it was designed to do.

Below there is a link to the GitHub repository containing the repository. With that you’ll find instructions on how to use it, and if you have any questions about PHPSpec, please do get in touch.

GitHub Repository: PHPStorm File Watcher for PHPSpec.

(None of the links featured in this blog post are affiliate links, we just really love our toolset!)

Handling Authentication when Using Behat & Mink