What is Behat?

Behat is a BDD framework for PHP projects. When you run it for the first time, it reads a text file containing a project feature description written in a human readable language, and because there is no code written yet, it fails the tests and generates the required steps to achieve the goal for that feature.

These generated steps are actually empty PHP methods. Your job is to write the code for each step. (We will deal with that shortly.) Assuming that the code is in place, by running Behat for the second time, it will go through all the required steps one more time and check whether that feature passes all tests. To see Behat in action, let's start by installing it.

Installing and configuring Behat

To get the basic Behat software ...

Get Mastering Symfony now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.