Skip to content

Commit 19f45ab

Browse files
authored
Update some tests for SQLite (#378)
* Update some tests for SQLite * Update some more tests
1 parent 1fe271c commit 19f45ab

File tree

5 files changed

+146
-10
lines changed

5 files changed

+146
-10
lines changed

features/plugin-auto-updates-disable.feature

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Feature: Disable auto-updates for WordPress plugins
3232
"""
3333
And the return code should be 0
3434

35-
@require-wp-5.5
35+
@require-wp-5.5 @require-mysql
3636
Scenario: Disable auto-updates for all plugins
3737
When I run `wp plugin auto-updates disable --all`
3838
Then STDOUT should be:
@@ -41,7 +41,16 @@ Feature: Disable auto-updates for WordPress plugins
4141
"""
4242
And the return code should be 0
4343

44-
@require-wp-5.5
44+
@require-wp-5.5 @require-sqlite
45+
Scenario: Disable auto-updates for all plugins
46+
When I run `wp plugin auto-updates disable --all`
47+
Then STDOUT should be:
48+
"""
49+
Success: Disabled 4 of 4 plugin auto-updates.
50+
"""
51+
And the return code should be 0
52+
53+
@require-wp-5.5 @require-mysql
4554
Scenario: Disable auto-updates for already disabled plugins
4655
When I run `wp plugin auto-updates disable hello`
4756
And I try `wp plugin auto-updates disable --all`
@@ -54,7 +63,20 @@ Feature: Disable auto-updates for WordPress plugins
5463
Error: Only disabled 2 of 3 plugin auto-updates.
5564
"""
5665

57-
@require-wp-5.5
66+
@require-wp-5.5 @require-sqlite
67+
Scenario: Disable auto-updates for already disabled plugins
68+
When I run `wp plugin auto-updates disable hello`
69+
And I try `wp plugin auto-updates disable --all`
70+
Then STDERR should contain:
71+
"""
72+
Warning: Auto-updates already disabled for plugin hello.
73+
"""
74+
And STDERR should contain:
75+
"""
76+
Error: Only disabled 3 of 4 plugin auto-updates.
77+
"""
78+
79+
@require-wp-5.5 @require-mysql
5880
Scenario: Filter when enabling auto-updates for already disabled plugins
5981
When I run `wp plugin auto-updates disable hello`
6082
And I run `wp plugin auto-updates disable --all --enabled-only`
@@ -64,6 +86,16 @@ Feature: Disable auto-updates for WordPress plugins
6486
"""
6587
And the return code should be 0
6688

89+
@require-wp-5.5 @require-sqlite
90+
Scenario: Filter when enabling auto-updates for already disabled plugins
91+
When I run `wp plugin auto-updates disable hello`
92+
And I run `wp plugin auto-updates disable --all --enabled-only`
93+
Then STDOUT should be:
94+
"""
95+
Success: Disabled 3 of 3 plugin auto-updates.
96+
"""
97+
And the return code should be 0
98+
6799
@require-wp-5.5
68100
Scenario: Filter when enabling auto-updates for already disabled selection of plugins
69101
When I run `wp plugin auto-updates disable hello`

features/plugin-auto-updates-enable.feature

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Feature: Enable auto-updates for WordPress plugins
3131
"""
3232
And the return code should be 0
3333

34-
@require-wp-5.5
34+
@require-wp-5.5 @require-mysql
3535
Scenario: Enable auto-updates for all plugins
3636
When I run `wp plugin auto-updates enable --all`
3737
Then STDOUT should be:
@@ -40,7 +40,16 @@ Feature: Enable auto-updates for WordPress plugins
4040
"""
4141
And the return code should be 0
4242

43-
@require-wp-5.5
43+
@require-wp-5.5 @require-sqlite
44+
Scenario: Enable auto-updates for all plugins
45+
When I run `wp plugin auto-updates enable --all`
46+
Then STDOUT should be:
47+
"""
48+
Success: Enabled 4 of 4 plugin auto-updates.
49+
"""
50+
And the return code should be 0
51+
52+
@require-wp-5.5 @require-mysql
4453
Scenario: Enable auto-updates for already enabled plugins
4554
When I run `wp plugin auto-updates enable hello`
4655
And I try `wp plugin auto-updates enable --all`
@@ -53,7 +62,20 @@ Feature: Enable auto-updates for WordPress plugins
5362
Error: Only enabled 2 of 3 plugin auto-updates.
5463
"""
5564

56-
@require-wp-5.5
65+
@require-wp-5.5 @require-sqlite
66+
Scenario: Enable auto-updates for already enabled plugins
67+
When I run `wp plugin auto-updates enable hello`
68+
And I try `wp plugin auto-updates enable --all`
69+
Then STDERR should contain:
70+
"""
71+
Warning: Auto-updates already enabled for plugin hello.
72+
"""
73+
And STDERR should contain:
74+
"""
75+
Error: Only enabled 3 of 4 plugin auto-updates.
76+
"""
77+
78+
@require-wp-5.5 @require-mysql
5779
Scenario: Filter when enabling auto-updates for already enabled plugins
5880
When I run `wp plugin auto-updates enable hello`
5981
And I run `wp plugin auto-updates enable --all --disabled-only`
@@ -63,6 +85,16 @@ Feature: Enable auto-updates for WordPress plugins
6385
"""
6486
And the return code should be 0
6587

88+
@require-wp-5.5 @require-sqlite
89+
Scenario: Filter when enabling auto-updates for already enabled plugins
90+
When I run `wp plugin auto-updates enable hello`
91+
And I run `wp plugin auto-updates enable --all --disabled-only`
92+
Then STDOUT should be:
93+
"""
94+
Success: Enabled 3 of 3 plugin auto-updates.
95+
"""
96+
And the return code should be 0
97+
6698
@require-wp-5.5
6799
Scenario: Filter when enabling auto-updates for already enabled selection of plugins
68100
When I run `wp plugin auto-updates enable hello`

features/plugin-auto-updates-status.feature

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Feature: Show the status of auto-updates for WordPress plugins
8181
Error: --enabled-only and --disabled-only are mutually exclusive and cannot be used at the same time.
8282
"""
8383

84-
@require-wp-5.5
84+
@require-wp-5.5 @require-mysql
8585
Scenario: The fields can be shown individually
8686
Given I run `wp plugin auto-updates enable hello`
8787

@@ -98,9 +98,26 @@ Feature: Show the status of auto-updates for WordPress plugins
9898
enabled
9999
"""
100100

101-
@require-wp-5.5
102-
Scenario: Formatting options work
101+
@require-wp-5.5 @require-sqlite
102+
Scenario: The fields can be shown individually
103+
Given I run `wp plugin auto-updates enable hello`
104+
105+
When I run `wp plugin auto-updates status --all --disabled-only --field=name`
106+
Then STDOUT should be:
107+
"""
108+
akismet
109+
sqlite-database-integration
110+
duplicate-post
111+
"""
112+
113+
When I run `wp plugin auto-updates status hello --field=status`
114+
Then STDOUT should be:
115+
"""
116+
enabled
117+
"""
103118

119+
@require-wp-5.5 @require-mysql
120+
Scenario: Formatting options work
104121
When I run `wp plugin auto-updates status --all --format=json`
105122
Then STDOUT should be:
106123
"""
@@ -115,3 +132,21 @@ Feature: Show the status of auto-updates for WordPress plugins
115132
hello,disabled
116133
duplicate-post,disabled
117134
"""
135+
136+
@require-wp-5.5 @require-sqlite
137+
Scenario: Formatting options work
138+
When I run `wp plugin auto-updates status --all --format=json`
139+
Then STDOUT should be:
140+
"""
141+
[{"name":"akismet","status":"disabled"},{"name":"hello","status":"disabled"},{"name":"sqlite-database-integration","status":"disabled"},{"name":"duplicate-post","status":"disabled"}]
142+
"""
143+
144+
When I run `wp plugin auto-updates status --all --format=csv`
145+
Then STDOUT should be:
146+
"""
147+
name,status
148+
akismet,disabled
149+
hello,disabled
150+
sqlite-database-integration,disabled
151+
duplicate-post,disabled
152+
"""

features/plugin-delete.feature

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

15+
@require-mysql
1516
Scenario: Delete all installed plugins
1617
When I run `wp plugin delete --all`
1718
Then STDOUT should be:
@@ -28,6 +29,24 @@ Feature: Delete WordPress plugins
2829
Success: No plugins deleted.
2930
"""
3031

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+
3150
Scenario: Attempting to delete a plugin that doesn't exist
3251
When I try `wp plugin delete edit-flow`
3352
Then STDOUT should be:
@@ -40,6 +59,7 @@ Feature: Delete WordPress plugins
4059
"""
4160
And the return code should be 0
4261

62+
@require-mysql
4363
Scenario: Excluding a plugin from deletion when using --all switch
4464
When I try `wp plugin delete --all --exclude=akismet,hello`
4565
Then STDOUT should be:
@@ -48,6 +68,15 @@ Feature: Delete WordPress plugins
4868
"""
4969
And the return code should be 0
5070

71+
@require-sqlite
72+
Scenario: Excluding a plugin from deletion when using --all switch
73+
When I try `wp plugin delete --all --exclude=akismet,hello,sqlite-database-integration`
74+
Then STDOUT should be:
75+
"""
76+
Success: No plugins deleted.
77+
"""
78+
And the return code should be 0
79+
5180
Scenario: Excluding a missing plugin should not throw an error
5281
Given a WP install
5382
And I run `wp plugin delete --all --exclude=missing-plugin`

features/plugin-uninstall.feature

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Feature: Uninstall a WordPress plugin
7272
Success: Uninstalled 2 of 2 plugins.
7373
"""
7474

75+
@require-mysql
7576
Scenario: Excluding a plugin from uninstallation when using --all switch
7677
When I try `wp plugin uninstall --all --exclude=akismet,hello`
7778
Then STDOUT should be:
@@ -80,7 +81,14 @@ Feature: Uninstall a WordPress plugin
8081
"""
8182
And the return code should be 0
8283

83-
84+
@require-sqlite
85+
Scenario: Excluding a plugin from uninstallation when using --all switch
86+
When I try `wp plugin uninstall --all --exclude=akismet,hello,sqlite-database-integration`
87+
Then STDOUT should be:
88+
"""
89+
Success: No plugins uninstalled.
90+
"""
91+
And the return code should be 0
8492

8593
Scenario: Excluding a missing plugin should not throw an error
8694
Given a WP install

0 commit comments

Comments
 (0)