1 # Behat Drupal Extension
3 The Drupal Extension is an integration layer between [Behat](http://behat.org),
4 [Mink Extension](https://github.com/Behat/MinkExtension), and Drupal. It
5 provides step definitions for common testing scenarios specific to Drupal
8 [![Build Status](https://travis-ci.org/jhedstrom/drupalextension.png?branch=master)](https://travis-ci.org/jhedstrom/drupalextension)
10 The Drupal Extension 3.3.x supports Drupal 6, 7 and 8, utilizes Behat 3.2+ and
11 runs on PHP 5.5+. It is compatible with Symfony components 2.x as well as 3.x
12 so it can be used on Drupal 8.4.x.
14 [![Latest Stable Version](https://poser.pugx.org/drupal/drupal-extension/v/stable.svg)](https://packagist.org/packages/drupal/drupal-extension)
15 [![Total Downloads](https://poser.pugx.org/drupal/drupal-extension/downloads.svg)](https://packagist.org/packages/drupal/drupal-extension)
16 [![Latest Unstable Version](https://poser.pugx.org/drupal/drupal-extension/v/unstable.svg)](https://packagist.org/packages/drupal/drupal-extension)
17 [![License](https://poser.pugx.org/drupal/drupal-extension/license.svg)](https://packagist.org/packages/drupal/drupal-extension)
18 [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jhedstrom/drupalextension/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jhedstrom/drupalextension/?branch=master)
22 ## Use it for testing your Drupal site.
24 If you're new to the Drupal Extension, we recommend starting with
25 the [Full documentation](https://behat-drupal-extension.readthedocs.org)
27 [![Documentation Status](https://readthedocs.org/projects/behat-drupal-extension/badge/?version=master)](https://behat-drupal-extension.readthedocs.org)
31 1. Install using [Composer](https://getcomposer.org/):
36 curl -sS https://getcomposer.org/installer | php
37 COMPOSER_BIN_DIR=bin php composer.phar require drupal/drupal-extension='~3.0'
40 1. In the projectdir, create a file called `behat.yml`. Below is the
41 minimal configuration. Many more options are covered in the
42 [Full documentation](https://behat-drupal-extension.readthedocs.org)
49 - Drupal\DrupalExtension\Context\DrupalContext
53 base_url: http://example.org/ # Replace with your site's URL
54 Drupal\DrupalExtension:
58 1. In the projectdir, run
64 1. Find pre-defined steps to work with using:
70 1. Define your own steps in `projectdir\features\FeatureContext.php`
72 1. Start adding your [feature files](http://behat.org/en/latest/user_guide/gherkin.html)
73 to the `features` directory of your repository.
75 ## Additional resources
77 * [Behat Drupal Extension documentation](https://behat-drupal-extension.readthedocs.org)
78 * [Behat documentation](http://docs.behat.org)
79 * [Mink documentation](http://mink.behat.org)
80 * [Drupal Behat group](http://groups.drupal.org/behat)
82 ## Examples and code snippets
84 * [Complex node creation, with field collections and entity references](https://gist.github.com/jhedstrom/5708233)
85 * [Achievements module support](https://gist.github.com/jhedstrom/9633067)
86 * [Drupal form element visibility](https://gist.github.com/pbuyle/7698675)
87 * [Track down PHP notices](https://www.godel.com.au/blog/use-behat-track-down-php-notices-they-take-over-your-drupal-site-forever)
88 * [Support for sites using basic HTTP authentication](https://gist.github.com/jhedstrom/5bc5192d6dacbf8cc459)
92 ### Backwards incompatible changes
94 Starting with 3.3.0 Behat Drupal Extension depends on Behat 3.2.0 which
95 requires all callbacks to be defined as static methods.
103 public function afterUserCreate(EntityScope $scope) {
114 public static function afterUserCreate(EntityScope $scope) {