Blog: PHP, Python, Linux, Web services & Continuous delivery

This post accompanies a project I've put on Github that provides an example of how to use Behat & Mink to create automated browser based acceptance tests. By combining the concepts and tooling from Behavior Driven Development (BDD) with remote browser driver technologies, we will describe the desired behavior of a system and then transform these descriptions into test simulations running in real web browsers. The intention of both the demo project and the post is to highlight that:

  • Driving your acceptance testing process with BDD techniques is a valuable concept
  • Behat and Mink are a solid choice for implementing acceptance tests

The demo project consists of a web site that sells ascii art (The Ascii Art Marketplace) and a test suite that covers the features 'add to basket' and 'newsletter sign up'. It also contains a wrapper script that will run the tests in either phantomJS or Selenium, this can be useful when hooking things up with Continuous Integration (CI). For more info on using phantomJS with Mink & Behat see this section a bit further down.

In this post, I'm mainly providing some background and ramblings around BDD, why automating acceptance testing is so valuable and general information on Behat & Mink. If your already familiar with this stuff then you might want to skip straight to the github repo at

Read more

In order to keep puppet manifests readable I'm organising the configuration using classes that (roughly) group steps by function such as PHP configuration, VHOST setup or Ruby installation. One of the main problems I (and several of my colleagues) were finding is that the order in which puppet classes are executed can change between one provision run and the next. However, with a little research (AKA reading the manual) I came across stages which exist to help with this very problem.

Puppet Stages

Puppet allows you to take a phased approach with the provisioning process, part of the stage definition is to declare if this stage should be executed before or after other stages. Once a stage is defined you then assign classes to it for execution. Puppet defines a 'main' stage by default in which all classes are added unless you specifically assign them to another stage as just described. The main stage is the starting point from which we reference when creating further stages.

Read more

I've just added support for xhprof profiler into my base vagrant LAMP (PHP) stack . It automatically adds profiling to any PHP file that is served from the default virtual host (document root: /vagrant/www/) and includes a link at the footer of each page over to the xhprof output. Graphviz has also been installed so callgraphs are generated if you want something more visual.

The vagrant instance is available on github here:

Read more

Provisioning new Virtualbox LAMP development VMs from scratch can be dome with minimal effort using vagrant. By making this process easy and fast I can dedicate an entire VM environment for each development project I have on hand and be sure that my environment remains consistent. That last part is not new, we have been using VMs like this for years but in my experience the VMs often become too valuable because of the manual effort required for initial set up, provisioning software, and ongoing maintenance. Vagrant scripts enable me to build and destroy VMs several times a day at speed, as and when required - removing the manual overhead.

No more "it works on my machine" scenarios, keep development environments isolated and in line with production specifications.

Read more

I started writing a plug-in for SublimeText 2 to speed up the development of Zend Framework 2 (ZF2) applications called ZF2Helper. So far I've implemented a couple of features and I intend to add more as and when I come across a ZF2 task that would benefit from some automation. Below is a quick example of using ZF2Helper to create new ZF2 modules and new controller actions. The full source is available on github: and the package can be installed in Sublime Text 2 using package_control.

Creating ZF2 Modules with ZF2Helper

Create an entirely new ZF2 module with 1 click rather than copying, pasting, renaming all files individually. Much quicker :)

This option is only available in the side bar context menu.

  1. In the side bar, navigate through to the root of the ZF2 modules directory
  2. Right click on the modules folder and select "ZF2Helper > New ZF2 Module"
  3. Input the name of the new module into the prompt
  4. Add the name of the module into the main ZF2 Application configuration file (ApplicationRoot / config / application.config.php)
Read more

All Posts