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 (and its related libraries) up and running is a simple two-step process. Just add them to your composer.json
file:
"require-dev": { // ... "behat/behat": "dev-master", "behat/mink-extension": "dev-master", "behat/mink": "dev-master...