Skip to content

Commit 2c1faba

Browse files
committed
Update some tests
1 parent 443d3a2 commit 2c1faba

File tree

6 files changed

+57
-34
lines changed

6 files changed

+57
-34
lines changed

features/plugin-activate.feature

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ Feature: Activate WordPress plugins
8787
"""
8888
And STDERR should be empty
8989

90+
# Disabled for SQLite because this tests a scenario with an empty plugins directory,
91+
# so the SQLite integration plugin would be missing.
92+
@require-mysql
9093
Scenario: Not giving a slug on activate should throw an error unless --all given
9194
When I try `wp plugin activate`
9295
Then the return code should be 1
@@ -134,7 +137,7 @@ Feature: Activate WordPress plugins
134137

135138
Scenario: Adding --exclude with plugin activate --all should exclude the plugins specified via --exclude
136139
When I try `wp plugin activate --all --exclude=hello`
137-
Then STDOUT should be:
140+
Then STDOUT should contain:
138141
"""
139142
Plugin 'akismet' activated.
140143
"""

features/plugin-deactivate.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Feature: Deactivate WordPress plugins
5858
Plugin 'akismet' deactivated.
5959
"""
6060

61+
# Disabled for SQLite because this tests a scenario with an empty plugins directory,
62+
# so the SQLite integration plugin would be missing.
63+
@require-mysql
6164
Scenario: Not giving a slug on deactivate should throw an error unless --all given
6265
When I try `wp plugin deactivate`
6366
Then the return code should be 1
@@ -78,14 +81,11 @@ Feature: Deactivate WordPress plugins
7881
"""
7982

8083
Scenario: Adding --exclude with plugin deactivate --all should exclude the plugins specified via --exclude
81-
When I run `wp plugin list --format=count`
82-
Then save STDOUT as {PLUGIN_COUNT}
83-
8484
When I try `wp plugin deactivate --all --exclude=hello`
8585
Then STDOUT should be:
8686
"""
8787
Plugin 'akismet' deactivated.
88-
Success: Deactivated 1 of {PLUGIN_COUNT} plugins.
88+
Success: Deactivated 1 of 1 plugins.
8989
"""
9090
And the return code should be 0
9191

features/plugin-delete.feature

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Feature: Delete WordPress plugins
1212
"""
1313
And the return code should be 0
1414

15+
# Disabled for SQLite because this tests a scenario with an empty plugins directory,
16+
# so the SQLite integration plugin would be missing.
1517
@require-mysql
1618
Scenario: Delete all installed plugins
1719
When I run `wp plugin delete --all`
@@ -29,24 +31,6 @@ Feature: Delete WordPress plugins
2931
Success: No plugins deleted.
3032
"""
3133

32-
@require-sqlite
33-
Scenario: Delete all installed plugins
34-
When I run `wp plugin delete --all`
35-
Then STDOUT should be:
36-
"""
37-
Deleted 'akismet' plugin.
38-
Deleted 'hello' plugin.
39-
Deleted 'sqlite-database-integration' plugin.
40-
Success: Deleted 3 of 3 plugins.
41-
"""
42-
And the return code should be 0
43-
44-
When I run the previous command again
45-
Then STDOUT should be:
46-
"""
47-
Success: No plugins deleted.
48-
"""
49-
5034
Scenario: Attempting to delete a plugin that doesn't exist
5135
When I try `wp plugin delete edit-flow`
5236
Then STDOUT should be:

features/plugin-uninstall.feature

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Feature: Uninstall a WordPress plugin
5151
Success: No plugins uninstalled.
5252
"""
5353

54+
# Not running the previous command again in this test
55+
# because the SQLite integration plugin is missing after the first run.
5456
@require-sqlite
5557
Scenario: Uninstall all installed plugins
5658
When I run `wp plugin uninstall --all`
@@ -63,12 +65,9 @@ Feature: Uninstall a WordPress plugin
6365
"""
6466
And the return code should be 0
6567

66-
When I run the previous command again
67-
Then STDOUT should be:
68-
"""
69-
Success: No plugins uninstalled.
70-
"""
71-
68+
# Disabled for SQLite because this test uninstalls all plugins,
69+
# including the SQLite integration plugin.
70+
@require-mysql
7271
Scenario: Uninstall all installed plugins when one or more activated
7372
When I run `wp plugin activate --all`
7473
Then STDOUT should contain:

features/plugin-update.feature

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ Feature: Update WordPress plugins
112112
2.6.1
113113
"""
114114

115-
@require-wp-5.2
115+
# Disabled for SQLite because this tests a scenario with an empty plugins directory,
116+
# so the SQLite integration plugin would be missing.
117+
@require-wp-5.2 @require-mysql
116118
Scenario: Not giving a slug on update should throw an error unless --all given
117119
Given a WP install
118120
And I run `wp plugin path`

features/plugin.feature

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ Feature: Manage WordPress plugins
297297
"""
298298
And the return code should be 0
299299

300+
@require-mysql
300301
Scenario: List plugins
301302
Given a WP install
302303

@@ -317,6 +318,30 @@ Feature: Manage WordPress plugins
317318
Automattic
318319
"""
319320

321+
@require-sqlite
322+
Scenario: List plugins
323+
Given a WP install
324+
325+
When I run `wp plugin activate akismet hello`
326+
Then STDOUT should not be empty
327+
328+
When I run `wp plugin list --status=inactive --field=name`
329+
Then STDOUT should contain:
330+
"""
331+
sqlite-database-integration
332+
"""
333+
334+
When I run `wp plugin list --status=active --fields=name,status,file`
335+
Then STDOUT should be a table containing rows:
336+
| name | status | file |
337+
| akismet | active | akismet/akismet.php |
338+
339+
When I run `wp plugin list --status=active --field=author`
340+
Then STDOUT should contain:
341+
"""
342+
Automattic
343+
"""
344+
320345
Scenario: List plugin by multiple statuses
321346
Given a WP multisite install
322347
And a wp-content/plugins/network-only.php file:
@@ -373,6 +398,9 @@ Feature: Manage WordPress plugins
373398
| name | status | update |
374399
| wordpress-importer | inactive | none |
375400

401+
# Disabled for SQLite because this tests a scenario with an empty plugins directory,
402+
# so the SQLite integration plugin would be missing.
403+
@require-mysql
376404
Scenario: Install a plugin when directory doesn't yet exist
377405
Given a WP install
378406

@@ -400,15 +428,20 @@ Feature: Manage WordPress plugins
400428
Scenario: Enable and disable all plugins
401429
Given a WP install
402430

403-
When I run `wp plugin activate --all`
431+
When I run `wp plugin list --format=count`
432+
Then save STDOUT as {PLUGIN_COUNT}
433+
434+
# Uses "try" because the SQLite plugin attempts to do a redirect.
435+
# See https://github.com/WordPress/sqlite-database-integration/issues/49
436+
When I try `wp plugin activate --all`
404437
Then STDOUT should be:
405438
"""
406439
Plugin 'akismet' activated.
407440
Plugin 'hello' activated.
408-
Success: Activated 2 of 2 plugins.
441+
Success: Activated {PLUGIN_COUNT} of {PLUGIN_COUNT} plugins.
409442
"""
410443

411-
When I run `wp plugin activate --all`
444+
When I try `wp plugin activate --all`
412445
Then STDOUT should be:
413446
"""
414447
Success: Plugins already activated.
@@ -619,7 +652,9 @@ Feature: Manage WordPress plugins
619652
| name | title | description | file |
620653
| db-error.php | | Custom database error message. | db-error.php |
621654

622-
@require-wp-4.0
655+
# Disabled for SQLite because this test uninstalls all plugins,
656+
# including the SQLite integration plugin.
657+
@require-wp-4.0 @require-mysql
623658
Scenario: Validate installed plugin's version.
624659
Given a WP installation
625660
And I run `wp plugin uninstall --all`

0 commit comments

Comments
 (0)