Security update for permissions_by_term
[yaffs-website] / vendor / drupal / drupal-extension / doc / localinstall.rst
1 Stand-alone installation 
2 ========================
3
4 A stand-alone installation is recommended when you want your tests and testing
5 environment to be portable, from local development to CI server, to client
6 infrastructure. It also makes documentation consistent and reliable.
7
8 1. Create a folder for your BDD tests::
9
10     mkdir projectfolder
11     cd projectfolder
12   
13   All the commands that follow are written to install from the root of your
14   project folder.
15
16 2. Install Composer, a php package manager::
17
18      curl -s https://getcomposer.org/installer | php
19
20 3. Create a composer.json file to tell Composer what to install.  To do that,
21    paste the following code into your editor and save as composer.json. The 
22    Drupal Extension requires Behat, Mink, and the Mink Extension. They will all 
23    be set up because they're dependencies of the Drupal Extension, so you don't 
24    have to specify them directly in the composer.json file:
25
26   .. literalinclude:: _static/snippets/composer.json 
27      :language: javascript 
28      :linenos:
29
30   For Drupal 8, you'll need to specify the correct version of Guzzle:
31
32   .. literalinclude:: _static/snippets/composer.json.d8
33      :language: javascript
34      :linenos:
35      :emphasize-lines: 4
36
37 4. Run the following command to install the Drupal Extension and all those
38    dependencies. This takes a while before you start to see output::
39
40     php composer.phar install
41
42 5. Configure your testing environment by creating a file called behat.yml with
43    the following. Be sure that you point the base_url at the web site YOU intend
44    to test. Do not include a trailing slash:
45
46   .. literalinclude:: _static/snippets/behat-1.yml 
47      :language: yaml 
48      :linenos:
49
50 6. Initialize behat. This creates the features folder with some basic things to
51    get you started, including your own FeatureContext.php file:: 
52
53     bin/behat --init
54
55 7. This will generate a FeatureContext.php file that looks like:
56
57   .. literalinclude:: _static/snippets/FeatureContext.php.inc
58      :language: php 
59      :linenos: 
60      :emphasize-lines: 12
61
62   This FeatureContext.php will be aware of both the Drupal Extension
63   and the Mink Extension, so you'll be able to take advantage of their
64   drivers add your own custom step definitions as well.
65
66 8. To ensure everything is set up appropriately, type::
67
68     bin/behat -dl
69   
70    You'll see a list of steps like the following, but longer, if you've
71    installed everything successfully:
72   
73
74   .. code-block:: gherkin 
75      :linenos:
76
77       default | Given I am an anonymous user
78       default | Given I am not logged in
79       default | Given I am logged in as a user with the :role role(s)
80       default | Given I am logged in as :name
81