NetTuts.com has posted a new tutorial today showing a sample testing BDD workflow using the Behat and PHPSpec testing tools. The BDD (behavior-driven development) approach focuses on using test-driven development and domain-driven design rather than just a unit testing approach.
In this tutorial, we will have a look at two different BDD tools, Behat and phpspec, and see how they can support you in your development process. Learning BDD can be confusing. New methodology, new tools and many questions, such as “what to test?” and “which tools to use?”. I hope that this rather simple example will give you ideas to how you can incorporate BDD into your own workflow.
The article isn’t a “getting started with BDD” guide, so you’ll need to know a bit about the ideas and process before getting into it. He starts with a look at the workflow Taylor Otwell (his inspiration for this) uses and how to install Behat and get to work on a first feature file. He describes the thought process behind the steps and some of the PHP code required to make them work. He then gets to the use of phpspec to mock out a needed “Config” dependency. He works though the rest of the tests and includes the output when all tests are passing.
Link: http://code.tutsplus.com/tutorials/a-bdd-workflow-with-behat-and-phpspec–cms-21601