Skip to content

Commit 3caa401

Browse files
committed
Remove unused chained_command; set & warn _SERVER['SERVER_NAME']; return code checks.
1 parent e37fa1a commit 3caa401

22 files changed

+103
-17
lines changed

features/comment-meta.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Feature: Manage comment custom fields
1717
"""
1818
Error: Could not find the comment with ID 999999.
1919
"""
20+
And the return code should be 1
2021

2122
When I run `wp comment-meta set 1 foo '[ "1", "2" ]' --format=json`
2223
Then STDOUT should not be empty
@@ -42,6 +43,7 @@ Feature: Manage comment custom fields
4243
Error: Parameter errors:
4344
unknown -- hi parameter
4445
"""
46+
And the return code should be 1
4547

4648
When I run `wp comment meta add 1 foo '"-- hi"' --format=json`
4749
Then STDOUT should contain:

features/comment.feature

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Feature: Manage WordPress comments
4646
"""
4747
Error: Invalid comment ID.
4848
"""
49+
And the return code should be 1
4950

5051
When I run `wp comment create --comment_post_ID=1`
5152
And I run `wp comment create --comment_post_ID=1`
@@ -67,6 +68,7 @@ Feature: Manage WordPress comments
6768
"""
6869
Error: Invalid comment ID.
6970
"""
71+
And the return code should be 1
7072

7173
Scenario: Get details about an existing comment
7274
When I run `wp comment get 1`
@@ -154,7 +156,7 @@ Feature: Manage WordPress comments
154156
Given I run `wp comment create --comment_post_ID=1 --comment_approved=0 --porcelain`
155157
And save STDOUT as {COMMENT_ID}
156158

157-
When I run `wp comment approve {COMMENT_ID}`
159+
When I run `wp comment approve {COMMENT_ID} --url=www.example.com`
158160
Then STDOUT should contain:
159161
"""
160162
Approved comment {COMMENT_ID}
@@ -166,7 +168,7 @@ Feature: Manage WordPress comments
166168
1
167169
"""
168170

169-
When I run `wp comment unapprove {COMMENT_ID}`
171+
When I run `wp comment unapprove {COMMENT_ID} --url=www.example.com`
170172
Then STDOUT should contain:
171173
"""
172174
Unapproved comment {COMMENT_ID}
@@ -178,13 +180,47 @@ Feature: Manage WordPress comments
178180
0
179181
"""
180182

183+
When I try `wp comment approve {COMMENT_ID}`
184+
Then STDOUT should contain:
185+
"""
186+
Approved comment {COMMENT_ID}
187+
"""
188+
And STDERR should contain:
189+
"""
190+
Warning: `$_SERVER['SERVER_NAME']` not set. Setting to 'example.com'. Notification email sent to post author may appear to come from 'example.com'.
191+
"""
192+
And the return code should be 0
193+
194+
When I run `wp comment get --field=comment_approved {COMMENT_ID}`
195+
Then STDOUT should be:
196+
"""
197+
1
198+
"""
199+
200+
When I try `wp comment unapprove {COMMENT_ID}`
201+
Then STDOUT should contain:
202+
"""
203+
Unapproved comment {COMMENT_ID}
204+
"""
205+
And STDERR should contain:
206+
"""
207+
Warning: `$_SERVER['SERVER_NAME']` not set. Setting to 'example.com'. Notification email sent to post author may appear to come from 'example.com'.
208+
"""
209+
And the return code should be 0
210+
211+
When I run `wp comment get --field=comment_approved {COMMENT_ID}`
212+
Then STDOUT should be:
213+
"""
214+
0
215+
"""
216+
181217
Scenario: Approving/unapproving comments with multidigit comment ID
182218
Given I run `wp comment delete $(wp comment list --field=ID)`
183219
And I run `wp comment generate --count=10 --quiet`
184220
And I run `wp comment create --porcelain`
185221
And save STDOUT as {COMMENT_ID}
186222

187-
When I run `wp comment unapprove {COMMENT_ID}`
223+
When I run `wp comment unapprove {COMMENT_ID} --url=www.example.com`
188224
Then STDOUT should contain:
189225
"""
190226
Unapproved comment {COMMENT_ID}
@@ -196,7 +232,7 @@ Feature: Manage WordPress comments
196232
10
197233
"""
198234

199-
When I run `wp comment approve {COMMENT_ID}`
235+
When I run `wp comment approve {COMMENT_ID} --url=www.example.com`
200236
Then STDOUT should contain:
201237
"""
202238
Approved comment {COMMENT_ID}

features/menu-location.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ Feature: Manage WordPress menu locations
3535
"""
3636
Error: Invalid menu secondary-menu.
3737
"""
38+
And the return code should be 1
3839

3940
When I run `wp menu create "Secondary Menu"`
4041
And I try `wp menu location assign secondary-menu secondary`
4142
Then STDERR should be:
4243
"""
4344
Error: Invalid location secondary.
4445
"""
46+
And the return code should be 1
4547

4648
When I run `wp menu location assign secondary-menu primary`
4749
Then STDOUT should be:

features/menu.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Feature: Manage WordPress menus
6262
Warning: Couldn't delete menu 'Your menu'.
6363
Error: No menus deleted.
6464
"""
65+
And the return code should be 1
6566

6667
When I run `wp menu create "My Menu"`
6768
And I run `wp menu list --fields=name,slug`

features/network-meta.feature

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

6-
When I try `wp network-meta`
6+
When I run `wp network-meta`
77
Then STDOUT should contain:
88
"""
99
usage: wp network meta
@@ -15,3 +15,4 @@ Feature: Manage network-wide custom fields.
1515
"""
1616
This is not a multisite install.
1717
"""
18+
And the return code should be 1

features/post-meta.feature

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Feature: Manage post custom fields
1717
"""
1818
Error: Could not find the post with ID 999999.
1919
"""
20+
And the return code should be 1
2021

2122
When I run `wp post-meta set 1 foo '[ "1", "2" ]' --format=json`
2223
Then STDOUT should not be empty
@@ -116,6 +117,7 @@ Feature: Manage post custom fields
116117
"""
117118
Error: Please specify a meta key, or use the --all flag.
118119
"""
120+
And the return code should be 1
119121

120122
When I run `wp post meta delete 1 --all`
121123
Then STDOUT should contain:
@@ -443,4 +445,4 @@ Feature: Manage post custom fields
443445
Then STDOUT should be JSON containing:
444446
"""
445447
[ "new", "bar" ]
446-
"""
448+
"""

features/post-term.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Feature: Manage post term
3737
"""
3838
Error: Invalid taxonomy foo2.
3939
"""
40+
And the return code should be 1
4041

4142
When I run `wp post term set 1 category new`
4243
Then STDOUT should be:
@@ -214,3 +215,4 @@ Feature: Manage post term
214215
"""
215216
Error: No need to specify terms while removing all terms.
216217
"""
218+
And the return code should be 1

features/post-type.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Feature: Manage WordPress post types
1616
"""
1717
Error: Post type invalid-post-type doesn't exist.
1818
"""
19+
And the return code should be 1
1920

2021
When I run `wp post-type get page`
2122
Then STDOUT should be a table containing rows:

features/post.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Feature: Manage WordPress posts
8888
"""
8989
And the return code should be 0
9090

91-
When I try `EDITOR='ex -i NONE -c %s/content/bunkum -c wq' wp post edit {POST_ID}`
91+
When I run `EDITOR='ex -i NONE -c %s/content/bunkum -c wq' wp post edit {POST_ID}`
9292
Then STDERR should be empty
9393
Then STDOUT should contain:
9494
"""
@@ -155,6 +155,7 @@ Feature: Manage WordPress posts
155155
"""
156156
Error: Unable to read content from 'invalid-file.html'.
157157
"""
158+
And the return code should be 1
158159

159160
Scenario: Creating/listing posts
160161
When I run `wp post create --post_title='Publish post' --post_content='Publish post content' --post_status='publish' --porcelain`

features/site-empty.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Feature: Empty a WordPress site of its data
1515
"""
1616
Error: This is not a multisite install.
1717
"""
18+
And the return code should be 1
1819

1920
When I run `wp post create --post_title='Test post' --post_content='Test content.' --porcelain`
2021
Then STDOUT should be:

0 commit comments

Comments
 (0)