Skip to content

Commit 646603f

Browse files
committed
Modernize deprecated syntax in Behat tests
WP-CLI now emits deprecation warnings when it rewrites legacy command syntax. Use the modern forms in the Behat scenarios so the standard run step can continue to require clean STDERR.
1 parent 6c2cd2c commit 646603f

11 files changed

Lines changed: 41 additions & 41 deletions

‎features/comment-meta.feature‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Feature: Manage comment custom fields
33
Scenario: Comment meta CRUD
44
Given a WP install
55

6-
When I run `wp comment-meta add 1 foo 'bar'`
6+
When I run `wp comment meta add 1 foo 'bar'`
77
Then STDOUT should not be empty
88

9-
When I run `wp comment-meta get 1 foo`
9+
When I run `wp comment meta get 1 foo`
1010
Then STDOUT should be:
1111
"""
1212
bar
@@ -19,19 +19,19 @@ Feature: Manage comment custom fields
1919
"""
2020
And the return code should be 1
2121

22-
When I run `wp comment-meta set 1 foo '[ "1", "2" ]' --format=json`
22+
When I run `wp comment meta set 1 foo '[ "1", "2" ]' --format=json`
2323
Then STDOUT should not be empty
2424

25-
When I run `wp comment-meta get 1 foo --format=json`
25+
When I run `wp comment meta get 1 foo --format=json`
2626
Then STDOUT should be:
2727
"""
2828
["1","2"]
2929
"""
3030

31-
When I run `wp comment-meta delete 1 foo`
31+
When I run `wp comment meta delete 1 foo`
3232
Then STDOUT should not be empty
3333

34-
When I try `wp comment-meta get 1 foo`
34+
When I try `wp comment meta get 1 foo`
3535
Then the return code should be 1
3636

3737
Scenario: Add comment meta with JSON serialization

‎features/comment.feature‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Feature: Manage WordPress comments
109109
1
110110
"""
111111

112-
When I run `wp comment url 1`
112+
When I run `wp comment list --comment__in=1 --orderby=comment__in --field=url`
113113
Then STDOUT should contain:
114114
"""
115115
#comment-1
@@ -125,14 +125,14 @@ Feature: Manage WordPress comments
125125
When I run `wp comment create --comment_post_ID=1 --porcelain`
126126
Then save STDOUT as {COMMENT_ID}
127127

128-
When I run `wp comment url 1 {COMMENT_ID}`
128+
When I run `wp comment list --comment__in=1,{COMMENT_ID} --orderby=comment__in --field=url`
129129
Then STDOUT should be:
130130
"""
131131
https://example.com/?p=1#comment-1
132132
https://example.com/?p=1#comment-{COMMENT_ID}
133133
"""
134134

135-
When I run `wp comment url {COMMENT_ID} 1`
135+
When I run `wp comment list --comment__in={COMMENT_ID},1 --orderby=comment__in --field=url`
136136
Then STDOUT should be:
137137
"""
138138
https://example.com/?p=1#comment-{COMMENT_ID}

‎features/menu-item.feature‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Feature: Manage WordPress menu items
99
Then STDOUT should be a number
1010
And save STDOUT as {POST_ID}
1111

12-
When I run `wp post url {POST_ID}`
12+
When I run `wp post list --post__in={POST_ID} --post_type=any --orderby=post__in --field=url`
1313
Then save STDOUT as {POST_LINK}
1414

1515
When I run `wp term create post_tag 'Test term' --slug=test --description='This is a test term' --porcelain`
1616
Then STDOUT should be a number
1717
And save STDOUT as {TERM_ID}
1818

19-
When I run `wp term url post_tag {TERM_ID}`
19+
When I run `wp term list post_tag --include={TERM_ID} --orderby=include --field=url`
2020
Then save STDOUT as {TERM_LINK}
2121

2222
When I run `wp menu create "Sidebar Menu"`

‎features/network-meta.feature‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Feature: Manage network-wide custom fields.
33
Scenario: Non-multisite
44
Given a WP install
55

6-
When I run `wp network-meta`
6+
When I run `wp network meta`
77
Then STDOUT should contain:
88
"""
99
usage: wp network meta
1010
"""
1111

12-
When I try `wp network-meta get 1 site_admins`
12+
When I try `wp network meta get 1 site_admins`
1313
Then STDOUT should be empty
1414
And STDERR should contain:
1515
"""

‎features/post-meta.feature‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Feature: Manage post custom fields
55
Scenario: Postmeta CRUD
66
Given a WP install
77

8-
When I run `wp post-meta add 1 foo 'bar'`
8+
When I run `wp post meta add 1 foo 'bar'`
99
Then STDOUT should not be empty
1010

11-
When I run `wp post-meta get 1 foo`
11+
When I run `wp post meta get 1 foo`
1212
Then STDOUT should be:
1313
"""
1414
bar
@@ -21,7 +21,7 @@ Feature: Manage post custom fields
2121
"""
2222
And the return code should be 1
2323

24-
When I run `wp post-meta set 1 foo '[ "1", "2" ]' --format=json`
24+
When I run `wp post meta set 1 foo '[ "1", "2" ]' --format=json`
2525
Then STDOUT should not be empty
2626

2727
When I run the previous command again
@@ -30,23 +30,23 @@ Feature: Manage post custom fields
3030
Success: Value passed for custom field 'foo' is unchanged.
3131
"""
3232

33-
When I run `wp post-meta get 1 foo --format=json`
33+
When I run `wp post meta get 1 foo --format=json`
3434
Then STDOUT should be:
3535
"""
3636
["1","2"]
3737
"""
3838

39-
When I run `echo "via STDIN" | wp post-meta set 1 foo`
40-
And I run `wp post-meta get 1 foo`
39+
When I run `echo "via STDIN" | wp post meta set 1 foo`
40+
And I run `wp post meta get 1 foo`
4141
Then STDOUT should be:
4242
"""
4343
via STDIN
4444
"""
4545

46-
When I run `wp post-meta delete 1 foo`
46+
When I run `wp post meta delete 1 foo`
4747
Then STDOUT should not be empty
4848

49-
When I try `wp post-meta get 1 foo`
49+
When I try `wp post meta get 1 foo`
5050
Then the return code should be 1
5151

5252
Scenario: List post meta
@@ -194,16 +194,16 @@ Feature: Manage post custom fields
194194
Scenario: Make sure WordPress receives the slashed data it expects in meta fields
195195
Given a WP install
196196

197-
When I run `wp post-meta add 1 foo 'My\Meta'`
197+
When I run `wp post meta add 1 foo 'My\Meta'`
198198
Then STDOUT should not be empty
199199

200-
When I run `wp post-meta get 1 foo`
200+
When I run `wp post meta get 1 foo`
201201
Then STDOUT should be:
202202
"""
203203
My\Meta
204204
"""
205205

206-
When I run `wp post-meta update 1 foo 'My\New\Meta'`
206+
When I run `wp post meta update 1 foo 'My\New\Meta'`
207207
Then STDOUT should be:
208208
"""
209209
Success: Updated custom field 'foo'.
@@ -215,7 +215,7 @@ Feature: Manage post custom fields
215215
Success: Value passed for custom field 'foo' is unchanged.
216216
"""
217217

218-
When I run `wp post-meta get 1 foo`
218+
When I run `wp post meta get 1 foo`
219219
Then STDOUT should be:
220220
"""
221221
My\New\Meta

‎features/post.feature‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Feature: Manage WordPress posts
285285
This is some bunkum.
286286
"""
287287

288-
When I run `wp post url 1 {POST_ID}`
288+
When I run `wp post list --post__in=1,{POST_ID} --post_type=any --orderby=post__in --field=url`
289289
Then STDOUT should be:
290290
"""
291291
https://example.com/?p=1

‎features/site-create.feature‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Feature: Create a new site on a WP multisite
6363
6464
$super_admins = array( 1 => 'admin' );
6565
"""
66-
When I run `wp core config {CORE_CONFIG_SETTINGS} --skip-check --extra-php < extra-config`
66+
When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --extra-php < extra-config`
6767
Then STDOUT should be:
6868
"""
6969
Success: Generated 'wp-config.php' file.

‎features/site-empty.feature‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Feature: Empty a WordPress site of its data
2626
When I run `wp media import {CACHE_DIR}/large-image.jpg --post_id=1`
2727
Then the wp-content/uploads/large-image.jpg file should exist
2828

29-
When I try `wp site url 1`
29+
When I try `wp site list --site__in=1 --field=url`
3030
Then STDERR should be:
3131
"""
3232
Error: This is not a multisite installation.

‎features/site.feature‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ Feature: Manage sites in a multisite installation
260260
And I run `wp site list --site__in={SITE_ID} --field=url | sed -e's,^\(.*\)://.*,\1,g'`
261261
And save STDOUT as {SCHEME}
262262

263-
When I run `wp site url {SITE_ID}`
263+
When I run `wp site list --site__in={SITE_ID} --field=url`
264264
Then STDOUT should be:
265265
"""
266266
{SCHEME}://example.com/first/
@@ -272,7 +272,7 @@ Feature: Manage sites in a multisite installation
272272
And I run `wp site list --site__in={SECOND_ID} --field=url | sed -e's,^\(.*\)://.*,\1,g'`
273273
And save STDOUT as {SECOND_SCHEME}
274274

275-
When I run `wp site url {SECOND_ID} {SITE_ID}`
275+
When I run `wp site list --site__in={SECOND_ID},{SITE_ID} --field=url`
276276
Then STDOUT should be:
277277
"""
278278
{SECOND_SCHEME}://example.com/second/

‎features/term.feature‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,20 @@ Feature: Manage WordPress terms
139139
When I run `wp term create category "Second Category" --porcelain`
140140
Then save STDOUT as {SECOND_TERM_ID}
141141

142-
When I run `wp term url category {TERM_ID}`
142+
When I run `wp term list category --include={TERM_ID} --orderby=include --field=url`
143143
Then STDOUT should be:
144144
"""
145145
https://example.com/?cat=2
146146
"""
147147

148-
When I run `wp term url category {TERM_ID} {SECOND_TERM_ID}`
148+
When I run `wp term list category --include={TERM_ID},{SECOND_TERM_ID} --orderby=include --field=url`
149149
Then STDOUT should be:
150150
"""
151151
https://example.com/?cat=2
152152
https://example.com/?cat=3
153153
"""
154154

155-
When I run `wp term url category {SECOND_TERM_ID} {TERM_ID}`
155+
When I run `wp term list category --include={SECOND_TERM_ID},{TERM_ID} --orderby=include --field=url`
156156
Then STDOUT should be:
157157
"""
158158
https://example.com/?cat=3

0 commit comments

Comments
 (0)