Security update for permissions_by_term
[yaffs-website] / vendor / drupal / drupal-extension / README.md
1 # Behat Drupal Extension
2
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
6 sites.
7
8 [![Build Status](https://travis-ci.org/jhedstrom/drupalextension.png?branch=master)](https://travis-ci.org/jhedstrom/drupalextension)
9
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.
13
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)
19
20
21
22 ## Use it for testing your Drupal site.
23
24 If you're new to the Drupal Extension, we recommend starting with 
25 the [Full documentation](https://behat-drupal-extension.readthedocs.org)
26
27 [![Documentation Status](https://readthedocs.org/projects/behat-drupal-extension/badge/?version=master)](https://behat-drupal-extension.readthedocs.org)
28
29 ### Quick start
30
31 1. Install using [Composer](https://getcomposer.org/):
32
33     ``` bash
34     mkdir projectdir
35     cd projectdir
36     curl -sS https://getcomposer.org/installer | php
37     COMPOSER_BIN_DIR=bin php composer.phar require drupal/drupal-extension='~3.0'
38     ```
39
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)  
43
44   ``` yaml
45   default:
46     suites:
47       default:
48         contexts:
49           - Drupal\DrupalExtension\Context\DrupalContext
50     extensions:
51       Behat\MinkExtension:
52         goutte: ~
53         base_url: http://example.org/  # Replace with your site's URL
54       Drupal\DrupalExtension:
55         blackbox: ~
56   ```
57
58 1. In the projectdir, run
59
60     ``` bash
61     bin/behat --init
62     ```
63
64 1. Find pre-defined steps to work with using:
65
66     ```bash
67     bin/behat -di
68     ```
69
70 1. Define your own steps in `projectdir\features\FeatureContext.php`
71
72 1. Start adding your [feature files](http://behat.org/en/latest/user_guide/gherkin.html) 
73    to the `features` directory of your repository.
74
75 ## Additional resources
76
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)
81
82 ## Examples and code snippets
83
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)
89
90 ## Release notes
91
92 ### Backwards incompatible changes
93
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.
96
97 Before 3.3.0:
98
99 ```
100 /**
101  * @afterUserCreate
102  */
103 public function afterUserCreate(EntityScope $scope) {
104   // ...
105 }
106 ```
107
108 Starting with 3.3.0:
109
110 ```
111 /**
112  * @afterUserCreate
113  */
114 public static function afterUserCreate(EntityScope $scope) {
115   // ...
116 }
117 ```