Security update for permissions_by_term
[yaffs-website] / vendor / drupal / drupal-extension / doc / globalinstall.rst
1 System-wide installation 
2 ========================
3
4 A system-wide installation allows you to maintain a single copy of the testing
5 tool set and use it for multiple test environments. Configuration is slightly
6 more complex than the stand-alone installation but many people prefer the
7 flexibility and ease-of-maintenance this setup provides.
8
9 Overview 
10 --------
11
12 To install the Drupal Extension globally:
13
14 #. Install Composer 
15 #. Install the Drupal Extension in `/opt/drupalextension` 
16 #. Create an alias to the behat binary in `/usr/local/bin` 
17 #. Create your test folder
18
19 Install Composer 
20 ----------------
21
22 Composer is a PHP dependency manager that will make sure all the pieces you
23 need get installed. `Full directions for global installation
24 <http://getcomposer.org/doc/00-intro.md#globally>`_ and more information can be
25 found on the `Composer website <http://getcomposer.org/>`_.::
26
27   curl -sS https://getcomposer.org/installer | 
28   php mv composer.phar /usr/local/bin/composer
29
30 Install the Drupal Extension 
31 ----------------------------
32
33 #. Make a directory in /opt (or wherever you choose) for the Drupal Extension::
34
35     cd /opt/ 
36     sudo mkdir drupalextension
37     cd drupalextension/
38
39 2. Create a file called `composer.json` and include the following:
40   
41   .. literalinclude:: _static/snippets/composer.json 
42      :language: javascript 
43      :linenos:
44
45 3. Run the install command::
46
47     sudo composer install
48
49   It will be a bit before you start seeing any output. It will also suggest
50   that you install additional tools, but they're not normally needed so you can
51   safely ignore that message.
52
53 4. Test that your install worked by typing the following::
54
55     bin/behat --help
56
57   If you were successful, you'll see the help output.
58
59 5. Make the binary available system-wide::
60
61     ln -s /opt/drupalextension/bin/behat /usr/local/bin/behat
62
63 Set up tests 
64 ------------ 
65
66 1. Create the directory that will hold your tests. There is no technical
67    reason this needs to be inside the Drupal directory at all. It is best to
68    keep them in the same version control repository so that the tests match the 
69    version of the site they are written for.
70
71   One clear pattern is to keep them in the sites folder as follows:
72
73   Single site: `sites/default/behat-tests`
74   
75   Multi-site or named single site: `/sites/my.domain.com/behat-tests`
76
77 2. Wherever you make your test folder, inside it create the behat.yml file:
78
79   .. literalinclude:: _static/snippets/behat-1.yml 
80      :language: yaml 
81      :linenos:
82
83 3. Initialize behat. This creates the features folder with some basic things to
84    get you started::
85
86     bin/behat --init
87
88 4. This will generate a FeatureContext.php file that looks like:
89
90   .. literalinclude:: _static/snippets/FeatureContext.php.inc
91      :language: php 
92      :linenos: 
93      :emphasize-lines: 12 
94
95   This will make your FeatureContext.php aware of both the Drupal Extension and
96   the Mink Extension, so you'll be able to take advantage of their drivers and
97   step definitions and add your own custom step definitions here. 
98   The FeatureContext.php file must be in the same directory as your behat.yml
99   file otherwise in step 5 you will get the following error:
100   
101     [Behat\Behat\Context\Exception\ContextNotFoundException]
102     `FeatureContext` context class not found and can not be used. 
103   
104
105 5. To ensure everything is set up appropriately, type::
106
107     behat -dl
108
109    You'll see a list of steps like the following, but longer, if you've
110    installed everything successfully:
111
112
113   .. code-block:: gherkin 
114      :linenos:
115
116       default | Given I am an anonymous user                                    
117       default | Given I am not logged in                                        
118       default | Given I am logged in as a user with the :role role(s)           
119       default | Given I am logged in as :name