Skip to content

Commit 66f76e4

Browse files
authored
Merge pull request #529 from wp-cli/fix-gherkin
Fix Gherkin lint issues
2 parents 7e7fd93 + 7e12df5 commit 66f76e4

20 files changed

+333
-327
lines changed

features/comment-meta.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,3 @@ Feature: Manage comment custom fields
8080
| 1 | apple | banana |
8181
| 1 | apple | banana |
8282
| 1 | banana | ["apple","apple"] |
83-

features/menu-item.feature

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Feature: Manage WordPress menu items
6565
Success: Deleted 1 of 1 menu items.
6666
"""
6767
And I run `wp menu item list sidebar-menu --format=count`
68-
Then STDOUT should be:
68+
And STDOUT should be:
6969
"""
7070
2
7171
"""
@@ -76,7 +76,7 @@ Feature: Manage WordPress menu items
7676
Success: Deleted 2 of 2 menu items.
7777
"""
7878
And I run `wp menu item list sidebar-menu --format=count`
79-
Then STDOUT should be:
79+
And STDOUT should be:
8080
"""
8181
0
8282
"""
@@ -103,8 +103,7 @@ Feature: Manage WordPress menu items
103103
| Child | {CHILD_ID} | {PARENT_ID} |
104104

105105
When I run `wp menu item delete {PARENT_ID}`
106-
107-
When I run `wp menu item list grandparent-test --fields=title,db_id,menu_item_parent`
106+
And I run `wp menu item list grandparent-test --fields=title,db_id,menu_item_parent`
108107
Then STDOUT should be a table containing rows:
109108
| title | db_id | menu_item_parent |
110109
| Grandparent | {GRANDPARENT_ID} | 0 |

features/option-pluck-patch.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,14 @@ Feature: Option commands have pluck and patch.
312312
And I run `wp option update option_name --format=json < input.json`
313313
314314
When I try `wp option patch update option_name foo`
315-
And STDERR should contain:
315+
Then STDERR should contain:
316316
"""
317317
Please provide value to update.
318318
"""
319319
And the return code should be 1
320320
321321
When I run `wp option patch update option_name foo 0`
322-
And STDOUT should be:
322+
Then STDOUT should be:
323323
"""
324324
Success: Updated 'option_name' option.
325325
"""

features/option.feature

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ Feature: Manage WordPress options
106106
0
107107
"""
108108

109-
110109
# JSON values
111110
When I run `wp option set json_opt '[ 1, 2 ]' --format=json`
112111
Then STDOUT should not be empty
@@ -120,7 +119,6 @@ Feature: Manage WordPress options
120119
[1,2]
121120
"""
122121

123-
124122
# Reading from files
125123
Given a value.json file:
126124
"""
@@ -182,7 +180,6 @@ Feature: Manage WordPress options
182180
| option_name | option_value | autoload |
183181
| hello | island | on |
184182
185-
186183
@require-wp-4.2
187184
@less-than-wp-6.6
188185
Scenario: Managed autoloaded options
Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,81 @@
11
Feature: Create Duplicate WordPress post from existing posts.
22

33
Background:
4-
Given a WP install
4+
Given a WP install
55

66
Scenario: Generate duplicate post.
7-
When I run `wp term create category "Test Category" --porcelain`
8-
Then save STDOUT as {TERM_ID}
7+
When I run `wp term create category "Test Category" --porcelain`
8+
Then save STDOUT as {TERM_ID}
99

10-
When I run `wp term create post_tag "Test Tag" --porcelain`
11-
Then save STDOUT as {TAG_ID}
10+
When I run `wp term create post_tag "Test Tag" --porcelain`
11+
Then save STDOUT as {TAG_ID}
1212

13-
When I run `wp post create --post_title='Test Duplicate Post' --post_category={TERM_ID} --porcelain`
14-
And save STDOUT as {POST_ID}
13+
When I run `wp post create --post_title='Test Duplicate Post' --post_category={TERM_ID} --porcelain`
14+
Then save STDOUT as {POST_ID}
1515

16-
When I run `wp post term add {POST_ID} post_tag {TAG_ID} --by=id`
17-
Then STDOUT should contain:
16+
When I run `wp post term add {POST_ID} post_tag {TAG_ID} --by=id`
17+
Then STDOUT should contain:
1818
"""
1919
Success: Added term.
2020
"""
2121

22-
When I run `wp post create --from-post={POST_ID} --porcelain`
23-
Then STDOUT should be a number
24-
And save STDOUT as {DUPLICATE_POST_ID}
22+
When I run `wp post create --from-post={POST_ID} --porcelain`
23+
Then STDOUT should be a number
24+
And save STDOUT as {DUPLICATE_POST_ID}
2525

26-
When I run `wp post get {DUPLICATE_POST_ID} --field=title`
27-
Then STDOUT should be:
28-
"""
29-
Test Duplicate Post
30-
"""
26+
When I run `wp post get {DUPLICATE_POST_ID} --field=title`
27+
Then STDOUT should be:
28+
"""
29+
Test Duplicate Post
30+
"""
3131

32-
When I run `wp post term list {DUPLICATE_POST_ID} category --field=term_id`
33-
Then STDOUT should be:
32+
When I run `wp post term list {DUPLICATE_POST_ID} category --field=term_id`
33+
Then STDOUT should be:
3434
"""
3535
{TERM_ID}
3636
"""
3737

38-
When I run `wp post term list {DUPLICATE_POST_ID} post_tag --field=term_id`
39-
Then STDOUT should be:
38+
When I run `wp post term list {DUPLICATE_POST_ID} post_tag --field=term_id`
39+
Then STDOUT should be:
4040
"""
4141
{TAG_ID}
4242
"""
4343

4444
@require-wp-4.4
4545
Scenario: Generate duplicate post with post metadata.
46-
When I run `wp post create --post_title='Test Post' --meta_input='{"key1":"value1","key2":"value2"}' --porcelain`
47-
Then save STDOUT as {POST_ID}
46+
When I run `wp post create --post_title='Test Post' --meta_input='{"key1":"value1","key2":"value2"}' --porcelain`
47+
Then save STDOUT as {POST_ID}
4848

49-
When I run `wp post create --from-post={POST_ID} --porcelain`
50-
Then save STDOUT as {DUPLICATE_POST_ID}
49+
When I run `wp post create --from-post={POST_ID} --porcelain`
50+
Then save STDOUT as {DUPLICATE_POST_ID}
5151

52-
When I run `wp post meta list {DUPLICATE_POST_ID} --format=table`
53-
Then STDOUT should be a table containing rows:
52+
When I run `wp post meta list {DUPLICATE_POST_ID} --format=table`
53+
Then STDOUT should be a table containing rows:
5454
| post_id | meta_key | meta_value |
5555
| {DUPLICATE_POST_ID} | key1 | value1 |
5656
| {DUPLICATE_POST_ID} | key2 | value2 |
5757

58-
5958
Scenario: Generate duplicate page.
60-
When I run `wp post create --post_type="page" --post_title="Test Page" --post_content="Page Content" --porcelain`
61-
Then save STDOUT as {POST_ID}
59+
When I run `wp post create --post_type="page" --post_title="Test Page" --post_content="Page Content" --porcelain`
60+
Then save STDOUT as {POST_ID}
6261

63-
When I run `wp post create --from-post={POST_ID} --post_title="Duplicate Page" --porcelain`
64-
Then save STDOUT as {DUPLICATE_POST_ID}
62+
When I run `wp post create --from-post={POST_ID} --post_title="Duplicate Page" --porcelain`
63+
Then save STDOUT as {DUPLICATE_POST_ID}
6564

66-
When I run `wp post list --post_type='page' --fields="title, content, type"`
67-
Then STDOUT should be a table containing rows:
65+
When I run `wp post list --post_type='page' --fields="title, content, type"`
66+
Then STDOUT should be a table containing rows:
6867
| post_title | post_content | post_type |
6968
| Test Page | Page Content | page |
7069
| Duplicate Page | Page Content | page |
7170

7271
Scenario: Change type of duplicate post.
73-
When I run `wp post create --post_title='Test Post' --porcelain`
74-
Then save STDOUT as {POST_ID}
72+
When I run `wp post create --post_title='Test Post' --porcelain`
73+
Then save STDOUT as {POST_ID}
7574

76-
When I run `wp post create --from-post={POST_ID} --post_type=page --porcelain`
77-
Then save STDOUT as {DUPLICATE_POST_ID}
75+
When I run `wp post create --from-post={POST_ID} --post_type=page --porcelain`
76+
Then save STDOUT as {DUPLICATE_POST_ID}
7877

79-
When I run `wp post get {DUPLICATE_POST_ID} --fields=type`
80-
Then STDOUT should be a table containing rows:
78+
When I run `wp post get {DUPLICATE_POST_ID} --fields=type`
79+
Then STDOUT should be a table containing rows:
8180
| Field | Value |
8281
| post_type | page |

features/post-generate.feature

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ Feature: Generate new WordPress posts
6161
Howdy! 3
6262
"""
6363
And STDERR should be empty
64-
And I run `wp post list --field=post_name --posts_per_page=4 --orderby=ID --order=asc`
64+
65+
When I run `wp post list --field=post_name --posts_per_page=4 --orderby=ID --order=asc`
6566
Then STDOUT should contain:
6667
"""
6768
hello-world
@@ -78,7 +79,8 @@ Feature: Generate new WordPress posts
7879
"""
7980
2018-07-01 00:00:00
8081
"""
81-
And I run `wp post list --field=post_date_gmt`
82+
83+
When I run `wp post list --field=post_date_gmt`
8284
Then STDOUT should contain:
8385
"""
8486
2018-07-01 00:00:00
@@ -91,7 +93,8 @@ Feature: Generate new WordPress posts
9193
"""
9294
2018-07-02 02:21:05
9395
"""
94-
And I run `wp post list --field=post_date_gmt`
96+
97+
When I run `wp post list --field=post_date_gmt`
9598
Then STDOUT should contain:
9699
"""
97100
2018-07-02 02:21:05
@@ -104,7 +107,8 @@ Feature: Generate new WordPress posts
104107
"""
105108
2018-07-03 00:00:00
106109
"""
107-
And I run `wp post list --field=post_date_gmt`
110+
111+
When I run `wp post list --field=post_date_gmt`
108112
Then STDOUT should contain:
109113
"""
110114
2018-07-03 00:00:00
@@ -117,7 +121,8 @@ Feature: Generate new WordPress posts
117121
"""
118122
2018-07-04 12:34:56
119123
"""
120-
And I run `wp post list --field=post_date_gmt`
124+
125+
When I run `wp post list --field=post_date_gmt`
121126
Then STDOUT should contain:
122127
"""
123128
2018-07-04 12:34:56
@@ -130,7 +135,8 @@ Feature: Generate new WordPress posts
130135
"""
131136
2018-07-05 17:17:17
132137
"""
133-
And I run `wp post list --field=post_date_gmt`
138+
139+
When I run `wp post list --field=post_date_gmt`
134140
Then STDOUT should contain:
135141
"""
136142
2018-07-05 17:17:17
@@ -143,7 +149,8 @@ Feature: Generate new WordPress posts
143149
"""
144150
2018-07-06 12:12:12
145151
"""
146-
And I run `wp post list --field=post_date_gmt`
152+
153+
When I run `wp post list --field=post_date_gmt`
147154
Then STDOUT should contain:
148155
"""
149156
2018-07-06 12:12:12
@@ -156,20 +163,22 @@ Feature: Generate new WordPress posts
156163
"""
157164
1999-12-31 00:00:00
158165
"""
159-
And I run `wp post list --field=post_date_gmt`
166+
167+
When I run `wp post list --field=post_date_gmt`
160168
Then STDOUT should contain:
161169
"""
162170
2000-01-01 00:00:00
163171
"""
164172

165-
Scenario: Generating posts with different post_date & post_date_gmt argument with time
173+
Scenario: Generating posts with different post_date & post_date_gmt argument with time
166174
When I run `wp post generate --count=1 --post_date="1999-12-31 11:11:00" --post_date_gmt="2000-01-01 02:11:00"`
167175
And I run `wp post list --field=post_date`
168176
Then STDOUT should contain:
169177
"""
170178
1999-12-31 11:11:00
171179
"""
172-
And I run `wp post list --field=post_date_gmt`
180+
181+
When I run `wp post list --field=post_date_gmt`
173182
Then STDOUT should contain:
174183
"""
175184
2000-01-01 02:11:00
@@ -178,13 +187,12 @@ Feature: Generate new WordPress posts
178187
Scenario: Generating posts when the site timezone is ahead of UTC
179188
When I run `wp option update timezone_string "Europe/Helsinki"`
180189
And I run `wp post delete 1 --force`
181-
182-
When I run `wp post list --field=post_status`
190+
And I run `wp post list --field=post_status`
183191
Then STDOUT should be empty
184-
192+
185193
When I run `wp post generate --count=1`
186194
And I run `wp post list --field=post_status`
187195
Then STDOUT should be:
188196
"""
189197
publish
190-
"""
198+
"""

features/post-meta.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Feature: Manage post custom fields
219219
My\New\Meta
220220
"""
221221

222-
Scenario: List post meta with or without single flag
222+
Scenario: List post meta with or without single flag
223223
Given a WP install
224224

225225
When I run `wp post meta add 1 apple banana`

features/post.feature

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feature: Manage WordPress posts
2020
And the return code should be 0
2121

2222
When I try `wp post exists 1000`
23-
And STDOUT should be empty
23+
Then STDOUT should be empty
2424
And the return code should be 1
2525

2626
When I run `wp post update {POST_ID} --post_title='Updated post'`
@@ -69,9 +69,10 @@ Feature: Manage WordPress posts
6969

7070
Scenario: Setting post categories
7171
When I run `wp term create category "First Category" --porcelain`
72-
And save STDOUT as {TERM_ID}
73-
And I run `wp term create category "Second Category" --porcelain`
74-
And save STDOUT as {SECOND_TERM_ID}
72+
Then save STDOUT as {TERM_ID}
73+
74+
When I run `wp term create category "Second Category" --porcelain`
75+
Then save STDOUT as {SECOND_TERM_ID}
7576

7677
When I run `wp post create --post_title="Test category" --post_category="First Category" --porcelain`
7778
Then STDOUT should be a number
@@ -246,7 +247,7 @@ Feature: Manage WordPress posts
246247

247248
When I run `EDITOR='ex -i NONE -c %s/content/bunkum -c wq' wp post edit {POST_ID}`
248249
Then STDERR should be empty
249-
Then STDOUT should contain:
250+
And STDOUT should contain:
250251
"""
251252
Updated post {POST_ID}.
252253
"""
@@ -380,9 +381,9 @@ Feature: Manage WordPress posts
380381

381382
Scenario: List posts with tax query
382383
When I run `wp term create category "First Category" --porcelain`
383-
When I run `wp term create category "Second Category" --porcelain`
384-
When I run `wp post create --post_title='post-1' --post_category="First Category"`
385-
When I run `wp post create --post_title='post-2' --post_category="Second Category"`
384+
And I run `wp term create category "Second Category" --porcelain`
385+
And I run `wp post create --post_title='post-1' --post_category="First Category"`
386+
And I run `wp post create --post_title='post-2' --post_category="Second Category"`
386387
And I run `wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z'`
387388
And I run `wp post list --field=post_title --tax_query='[{"taxonomy":"category","field":"slug","terms":"first-category"}]'`
388389
Then STDOUT should contain:

0 commit comments

Comments
 (0)