Skip to content

Commit 08984ff

Browse files
committed
Test breakages run -> try; return code and STDOUT checks.
1 parent d7e7553 commit 08984ff

11 files changed

Lines changed: 97 additions & 17 deletions

features/plugin-deactivate.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Feature: Deactivate WordPress plugins
2020
Warning: The 'edit-flow' plugin could not be found.
2121
Error: No plugins deactivated.
2222
"""
23+
And STDOUT should be empty
2324
And the return code should be 1
2425

2526
When I try `wp plugin deactivate akismet hello edit-flow`

features/plugin-delete.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Feature: Delete WordPress plugins
1313
And the return code should be 0
1414

1515
Scenario: Attempting to delete a plugin that doesn't exist
16-
When I run `wp plugin delete edit-flow`
16+
When I try `wp plugin delete edit-flow`
1717
Then STDOUT should be:
1818
"""
1919
Success: Plugin already deleted.

features/plugin-install.feature

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ Feature: Install WordPress plugins
2929
"""
3030
Warning: Destination folder already exists
3131
"""
32+
Then STDERR should contain:
33+
"""
34+
Error: No plugins installed.
35+
"""
3236
And the wp-content/plugins/one-time-login directory should exist
3337
And the wp-content/plugins/one-time-login-master directory should not exist
38+
And the return code should be 1
3439
3540
When I run `wp plugin install https://github.com/runcommand/one-time-login/archive/master.zip --force`
3641
Then STDOUT should contain:
@@ -84,7 +89,12 @@ Feature: Install WordPress plugins
8489
"""
8590
Warning: edit-flow: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration.
8691
"""
92+
And STDERR should contain:
93+
"""
94+
Error: No plugins installed.
95+
"""
8796
And STDOUT should be empty
97+
And the return code should be 1
8898
8999
When I run `wp plugin install edit-flow`
90100
Then STDOUT should contain:
@@ -112,7 +122,7 @@ Feature: Install WordPress plugins
112122
"""
113123
And the return code should be 1
114124
115-
When I run `wp plugin install user-switching`
125+
When I try `wp plugin install user-switching`
116126
Then STDOUT should be:
117127
"""
118128
Success: Plugin already installed.
@@ -145,6 +155,11 @@ Feature: Install WordPress plugins
145155
"""
146156
Warning: Destination folder already exists. "{WORKING_DIR}/wp-content/plugins/akismet/"
147157
"""
158+
And STDERR should contain:
159+
"""
160+
Error: No plugins installed.
161+
"""
162+
And the return code should be 1
148163
149164
Scenario: Don't attempt to rename ZIPs coming from a GitHub archive release/tag
150165
Given a WP install

features/plugin-uninstall.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ Feature: Uninstall a WordPress plugin
2222
Warning: The 'akismet' plugin is active.
2323
Error: No plugins uninstalled.
2424
"""
25+
And STDOUT should be empty
2526
And the return code should be 1
2627

2728
Scenario: Attempting to uninstall a plugin that doesn't exist
28-
When I run `wp plugin uninstall edit-flow`
29+
When I try `wp plugin uninstall edit-flow`
2930
Then STDOUT should be:
3031
"""
3132
Success: Plugin already uninstalled.

features/plugin-update.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Feature: Update WordPress plugins
2020
"""
2121
Error: Can't find the requested plugin's version 0.5.3 in the WordPress.org plugin repository (HTTP code 404).
2222
"""
23+
And the return code should be 1
2324

2425
When I run `wp plugin list`
2526
Then STDOUT should be a table containing rows:
@@ -42,6 +43,7 @@ Feature: Update WordPress plugins
4243
"""
4344
Error: --minor and --patch cannot be used together.
4445
"""
46+
And the return code should be 1
4547

4648
Scenario: Exclude plugin updates from bulk updates.
4749
Given a WP install

features/plugin.feature

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Feature: Manage WordPress plugins
3333
"""
3434
The 'zombieLand' plugin could not be found.
3535
"""
36+
And STDOUT should be empty
37+
And the return code should be 1
3638

3739
# Check that the inner-plugin is not picked up
3840
When I run `mv {PLUGIN_DIR}/plugin1 {PLUGIN_DIR}/Zombieland/`
@@ -69,6 +71,12 @@ Feature: Manage WordPress plugins
6971
"""
7072
The 'Zombieland' plugin is active.
7173
"""
74+
And STDERR should contain:
75+
"""
76+
Error: No plugins uninstalled.
77+
"""
78+
And STDOUT should be empty
79+
And the return code should be 1
7280

7381
When I run `wp plugin deactivate Zombieland`
7482
Then STDOUT should not be empty
@@ -88,10 +96,15 @@ Feature: Manage WordPress plugins
8896
And the {PLUGIN_DIR}/zombieland file should not exist
8997

9098
When I try the previous command again
91-
Then STDERR should contain:
99+
Then STDERR should be:
100+
"""
101+
Warning: The 'Zombieland' plugin could not be found.
102+
"""
103+
And STDOUT should be:
92104
"""
93-
The 'Zombieland' plugin could not be found.
105+
Success: Plugin already uninstalled.
94106
"""
107+
And the return code should be 0
95108

96109
Scenario: Install a plugin, activate, then force install an older version of the plugin
97110
Given a WP install
@@ -124,6 +137,8 @@ Feature: Manage WordPress plugins
124137
"""
125138
Error: Please specify one or more plugins, or use --all.
126139
"""
140+
And STDOUT should be empty
141+
And the return code should be 1
127142

128143
When I run `wp plugin update --all --format=summary | grep 'updated successfully from'`
129144
Then STDOUT should contain:
@@ -144,6 +159,7 @@ Feature: Manage WordPress plugins
144159
"""
145160
Error: No plugins updated.
146161
"""
162+
And the return code should be 1
147163

148164
When I run `wp plugin install wordpress-importer --version=0.5 --force`
149165
Then STDOUT should not be empty
@@ -157,6 +173,7 @@ Feature: Manage WordPress plugins
157173
"""
158174
Error: Only updated 1 of 3 plugins.
159175
"""
176+
And the return code should be 1
160177

161178
Scenario: Activate a network-only plugin on single site
162179
Given a WP install
@@ -215,7 +232,7 @@ Feature: Manage WordPress plugins
215232
| name | status |
216233
| akismet | active |
217234

218-
When I run `wp plugin activate akismet`
235+
When I try `wp plugin activate akismet`
219236
Then STDERR should contain:
220237
"""
221238
Warning: Plugin 'akismet' is already active.
@@ -224,6 +241,7 @@ Feature: Manage WordPress plugins
224241
"""
225242
Success: Plugin already activated.
226243
"""
244+
And the return code should be 0
227245

228246
When I run `wp plugin activate akismet --network`
229247
Then STDOUT should be:
@@ -232,7 +250,7 @@ Feature: Manage WordPress plugins
232250
Success: Network activated 1 of 1 plugins.
233251
"""
234252

235-
When I run `wp plugin activate akismet --network`
253+
When I try `wp plugin activate akismet --network`
236254
Then STDERR should be:
237255
"""
238256
Warning: Plugin 'akismet' is already network active.
@@ -241,13 +259,15 @@ Feature: Manage WordPress plugins
241259
"""
242260
Success: Plugin already network activated.
243261
"""
262+
And the return code should be 0
244263

245264
When I try `wp plugin deactivate akismet`
246265
Then STDERR should be:
247266
"""
248267
Warning: Plugin 'akismet' is network active and must be deactivated with --network flag.
249268
Error: No plugins deactivated.
250269
"""
270+
And STDOUT should be empty
251271
And the return code should be 1
252272

253273
When I run `wp plugin deactivate akismet --network`
@@ -258,7 +278,7 @@ Feature: Manage WordPress plugins
258278
"""
259279
And the return code should be 0
260280

261-
When I run `wp plugin deactivate akismet`
281+
When I try `wp plugin deactivate akismet`
262282
Then STDERR should be:
263283
"""
264284
Warning: Plugin 'akismet' isn't active.
@@ -375,6 +395,8 @@ Feature: Manage WordPress plugins
375395
"""
376396
Error: The 'wordpress-importer' plugin could not be found.
377397
"""
398+
And STDOUT should be empty
399+
And the return code should be 1
378400

379401
Scenario: Deactivate and uninstall a plugin, part two
380402
Given a WP install
@@ -397,7 +419,8 @@ Feature: Manage WordPress plugins
397419
"""
398420
Error: The 'wordpress-importer' plugin could not be found.
399421
"""
400-
422+
And STDOUT should be empty
423+
And the return code should be 1
401424

402425
Scenario: Uninstall a plugin without deleting
403426
Given a WP install
@@ -465,7 +488,7 @@ Feature: Manage WordPress plugins
465488
Scenario: Ignore empty slugs
466489
Given a WP install
467490

468-
When I run `wp plugin install ''`
491+
When I try `wp plugin install ''`
469492
Then STDERR should contain:
470493
"""
471494
Warning: Ignoring ambigious empty slug value.
@@ -474,6 +497,7 @@ Feature: Manage WordPress plugins
474497
"""
475498
Plugin installed successfully
476499
"""
500+
And the return code should be 0
477501

478502
Scenario: Plugin hidden by "all_plugins" filter
479503
Given a WP install

features/theme-delete.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Feature: Delete WordPress themes
1717
When I run `wp theme delete p2`
1818
Then STDOUT should not be empty
1919

20-
When I run the previous command again
20+
When I try the previous command again
2121
Then STDOUT should be:
2222
"""
2323
Success: Theme already deleted.

features/theme-install.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Feature: Install WordPress themes
1919
"""
2020
And the return code should be 1
2121

22-
When I run `wp theme install p2`
22+
When I try `wp theme install p2`
2323
Then STDOUT should be:
2424
"""
2525
Success: Theme already installed.
@@ -36,6 +36,7 @@ Feature: Install WordPress themes
3636
Warning: Couldn't find 'p2-not-a-theme' in the WordPress.org theme directory.
3737
Error: No themes installed.
3838
"""
39+
And STDOUT should be empty
3940
And the return code should be 1
4041

4142
Scenario: Ensure automatic parent theme installation uses http cacher

features/theme-mod.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Feature: Manage WordPress theme mods
1212
"""
1313
You must specify at least one mod or use --all.
1414
"""
15+
And STDOUT should be empty
16+
And the return code should be 1
1517

1618
When I run `wp theme mod set background_color 123456`
1719
And I run `wp theme mod get --all`
@@ -55,6 +57,8 @@ Feature: Manage WordPress theme mods
5557
"""
5658
You must specify at least one mod or use --all.
5759
"""
60+
And STDOUT should be empty
61+
And the return code should be 1
5862

5963
When I run `wp theme mod remove background_color`
6064
Then STDOUT should be:

0 commit comments

Comments
 (0)