Security update for permissions_by_term
[yaffs-website] / vendor / drupal / drupal-extension / features / field_handlers.feature
1 @api
2 Feature: FieldHandlers
3   In order to prove field handling is working properly
4   As a developer
5   I need to use the step definitions of this context
6
7   # @d7 and @d8 scenarios assume a "standard" install of Drupal and require the
8   # feature "fixtures/drupalN/modules/behat_test" to enabled on the site.
9   @d7 @d8
10   Scenario: Test various node field handlers in Drupal 7 and 8
11     Given "page" content:
12       | title      |
13       | Page one   |
14       | Page two   |
15       | Page three |
16     When I am viewing a "post" content:
17       | title                | Post title                                                                       |
18       | body                 | PLACEHOLDER BODY                                                                 |
19       | field_post_reference | Page one, Page two                                                               |
20       | field_post_date      | 2015-02-08 17:45:00                                                              |
21       | field_post_links     | Link 1 - http://example.com, Link 2 - http://example.com                         |
22       | field_post_select    | One, Two                                                                         |
23       | field_post_address   | country: BE - locality: Brussel - thoroughfare: Louisalaan 1 - postal_code: 1000 |
24     Then I should see "Post title"
25     And I should see "PLACEHOLDER BODY"
26     And I should see "Page one"
27     And I should see "Page two"
28     And I should see "Sunday, February 8, 2015"
29     And I should see the link "Link 1"
30     And I should see the link "Link 2"
31     And I should see "One"
32     And I should see "Two"
33     And I should see "Belgium"
34     And I should see "Brussel"
35     And I should see "1000"
36     And I should see "Louisalaan 1"
37
38   # This is identical to the previous test, but uses human readable names for
39   # the field names. This is better from a BDD standpoint. Please have a look at
40   # FeatureContext::transformPostContentTable() to see how the mapping between
41   # the machine names and human readable names is defined.
42   @d7 @d8
43   Scenario: Test using human readable names for fields using @Transform
44     Given "page" content:
45       | title      |
46       | Page one   |
47       | Page two   |
48       | Page three |
49     When I am viewing a "post" content:
50       | title     | Post title                                                                       |
51       | body      | PLACEHOLDER BODY                                                                 |
52       | reference | Page one, Page two                                                               |
53       | date      | 2015-02-08 17:45:00                                                              |
54       | links     | Link 1 - http://example.com, Link 2 - http://example.com                         |
55       | select    | One, Two                                                                         |
56       | address   | country: BE - locality: Brussel - thoroughfare: Louisalaan 1 - postal_code: 1000 |
57     Then I should see "Page one"
58     And I should see "Page two"
59     And I should see "Sunday, February 8, 2015"
60     And I should see the link "Link 1"
61     And I should see the link "Link 2"
62     And I should see "One"
63     And I should see "Two"
64     And I should see "Belgium"
65     And I should see "Brussel"
66     And I should see "1000"
67     And I should see "Louisalaan 1"
68
69   @d7 @d8
70   Scenario: Test alternative syntax for named field columns on node content
71     When I am viewing a "post" content:
72       | title                           | Post title                  |
73       | field_post_address:country      | FR                          |
74       | field_post_address:locality     | Paris                       |
75       | field_post_address:thoroughfare | 1 Avenue des Champs Elysées |
76       | field_post_address:postal_code  | 75008                       |
77     Then I should see "France"
78     And I should see "Paris"
79     And I should see "1 Avenue des Champs Elysées"
80     And I should see "75008"
81
82   @d7 @d8
83   Scenario: Test shorthand syntax for named field columns on node content
84     When I am viewing a "post" content:
85       | title                      | Post title      |
86       | field_post_address:country | GB              |
87       | :locality                  | London          |
88       | :thoroughfare              | 1 Oxford Street |
89       | :postal_code               | W1D 1AN         |
90     Then I should see "United Kingdom"
91     And I should see "London"
92     And I should see "1 Oxford Street"
93     And I should see "W1D 1AN"
94
95   @d7 @d8
96   Scenario: Test multivalue fields with named field columns on node content
97     When I am viewing a "post" content:
98       | title                      | Post title                             |
99       | field_post_address:country | IT, JP                                 |
100       | :locality                  | Milan, Tokyo                           |
101       | :thoroughfare              | 1 Corso Buenos Aires, Shibuya Crossing |
102       | :postal_code               | 20124, 150-0040                        |
103     Then I should see "Italy"
104     And I should see "Milan"
105     And I should see "1 Corso Buenos Aires"
106     And I should see "20124"
107     And I should see "Japan"
108     And I should see "Tokyo"
109     And I should see "Shibuya Crossing"
110     And I should see "150-0040"
111
112   @d7 @d8
113   Scenario: Test various user field handlers in Drupal 7.
114     Given "tags" terms:
115       | name      |
116       | Tag one   |
117       | Tag two   |
118     And "page" content:
119       | title      |
120       | Page one   |
121       | Page two   |
122       | Page three |
123     And users:
124       | name     | mail         | field_tags       | field_post_reference | field_post_address                                                               |
125       | Jane Doe |              |                  |                      |                                                                                  |
126       | John Doe | john@doe.com | Tag one, Tag two | Page one, Page two   | country: BE - locality: Brussel - thoroughfare: Louisalaan 1 - postal_code: 1000 |
127     And I am logged in as a user with the "administrator" role
128     When I visit "admin/people"
129     Then I should see the link "Jane Doe"
130     And I should see the link "John Doe"
131     When I click "John Doe"
132     Then I should see the link "Tag one"
133     And I should see the link "Tag two"
134     But I should not see the link "Tag three"
135     And I should see "Page one"
136     And I should see "Page two"
137     But I should not see "Page three"
138     And I should see "Belgium"
139     And I should see "Brussel"
140     And I should see "1000"
141     And I should see "Louisalaan 1"
142
143   @d7 @d8
144   Scenario: Test using @Transform to provide human friendly aliases for named field columns
145     Given users:
146       | name     | mail             | street        | city     | postcode | country |
147       | Jane Doe | jane@example.com | Pioneer Place | Portland | OR 97204 | US      |
148     And I am logged in as a user with the "administrator" role
149     When I visit "admin/people"
150     And I click "Jane Doe"
151     Then I should see "United States"
152     And I should see "Portland"
153     And I should see "Pioneer Place"
154     And I should see "OR 97204"
155
156   @d7 @d8
157   Scenario: Test taxonomy term reference field handler
158     Given "tags" terms:
159       | name      |
160       | Tag one   |
161       | Tag two   |
162       | Tag three |
163       | Tag four  |
164     And "article" content:
165       | title           | body             | promote | field_tags                  |
166       | Article by Joe  | PLACEHOLDER BODY |       1 | Tag one, Tag two, Tag three |
167       | Article by Mike | PLACEHOLDER BODY |       1 | Tag four                    |
168       | Article by Jane |                  |         |                             |
169     And I am logged in as a user with the "administrator" role
170     When I visit "admin/content"
171     Then I should see the link "Article by Joe"
172     And I should see the link "Article by Mike"
173     And I should see the link "Article by Jane"
174     When I am on the homepage
175     Then I should see the link "Article by Joe"
176     And I should see the link "Tag one"
177     And I should see the link "Tag two"
178     And I should see the link "Tag three"
179     And I should see the link "Article by Mike"
180     And I should see the link "Tag four"
181     And I should see the link "Article by Joe"
182     And I should not see the link "Article by Jane"
183
184   @d7
185   # There is no support for date ranges in D8 yet, so only test D7 for now.
186   Scenario: Test date ranges in Drupal 7
187     When I am viewing a "post" content:
188       | title                | Post title                                                                       |
189       | body                 | PLACEHOLDER BODY                                                                 |
190       | field_post_dates     | 2015-02-10 17:45:00 - 2015-03-10 17:45:00                                        |
191     Then I should see "to Tuesday, March 10, 2015"