-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathplugin-uninstall.feature
More file actions
207 lines (183 loc) · 6.4 KB
/
plugin-uninstall.feature
File metadata and controls
207 lines (183 loc) · 6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
Feature: Uninstall a WordPress plugin
Background:
Given a WP install
And I run `wp plugin install https://github.com/wp-cli/sample-plugin/archive/refs/heads/master.zip`
Scenario: Uninstall an installed plugin should uninstall, delete files
When I run `wp plugin uninstall akismet`
Then STDOUT should be:
"""
Uninstalled and deleted 'akismet' plugin.
Success: Uninstalled 1 of 1 plugins.
"""
And the return code should be 0
And STDERR should be empty
And the wp-content/plugins/akismet directory should not exist
Scenario: Uninstall an installed plugin but do not delete its files
When I run `wp plugin uninstall akismet --skip-delete`
Then STDOUT should be:
"""
Ran uninstall procedure for 'akismet' plugin without deleting.
Success: Uninstalled 1 of 1 plugins.
"""
And the return code should be 0
And STDERR should be empty
And the wp-content/plugins/akismet directory should exist
Scenario: Uninstall a plugin that is not in a folder and has custom name
When I run `wp plugin uninstall sample-plugin`
Then STDOUT should be:
"""
Uninstalled and deleted 'sample-plugin' plugin.
Success: Uninstalled 1 of 1 plugins.
"""
And the return code should be 0
And STDERR should be empty
And the wp-content/plugins/sample-plugin.php file should not exist
Scenario: Missing required inputs
When I try `wp plugin uninstall`
Then STDERR should be:
"""
Error: Please specify one or more plugins, or use --all.
"""
And the return code should be 1
And STDOUT should be empty
Scenario: Attempting to uninstall a plugin that's activated
When I run `wp plugin activate akismet`
Then STDOUT should not be empty
When I try `wp plugin uninstall akismet`
Then STDERR should be:
"""
Warning: The 'akismet' plugin is active.
Error: No plugins uninstalled.
"""
And STDOUT should be empty
And the return code should be 1
Scenario: Attempting to uninstall a plugin that's activated (using --deactivate)
When I run `wp plugin activate akismet`
Then STDOUT should not be empty
When I try `wp plugin uninstall akismet --deactivate`
Then STDOUT should be:
"""
Deactivating 'akismet'...
Plugin 'akismet' deactivated.
Uninstalled and deleted 'akismet' plugin.
Success: Uninstalled 1 of 1 plugins.
"""
And STDERR should be empty
And the return code should be 0
Scenario: Attempting to uninstall a plugin that doesn't exist
When I try `wp plugin uninstall debug-bar`
Then STDERR should be:
"""
Warning: The 'debug-bar' plugin could not be found.
Error: No plugins uninstalled.
"""
And the return code should be 1
Scenario: Uninstall all installed plugins
When I run `wp plugin uninstall --all`
Then STDOUT should contain:
"""
Uninstalled and deleted 'akismet' plugin.
"""
And STDOUT should contain:
"""
Uninstalled and deleted 'sample-plugin' plugin.
"""
And STDOUT should contain:
"""
Success: Uninstalled 3 of 3 plugins.
"""
And the return code should be 0
And STDERR should be empty
When I run the previous command again
Then STDOUT should be:
"""
Success: No plugins uninstalled.
"""
And STDERR should be empty
Scenario: Uninstall all installed plugins when one or more activated
When I run `wp plugin activate --all`
Then STDOUT should contain:
"""
Success: Activated 3 of 3 plugins.
"""
When I try `wp plugin uninstall --all`
Then STDERR should contain:
"""
Warning: The 'akismet' plugin is active.
"""
And STDERR should contain:
"""
Warning: The 'sample-plugin' plugin is active.
"""
And STDERR should contain:
"""
Error: No plugins uninstalled.
"""
And the return code should be 1
And STDOUT should be empty
When I run `wp plugin uninstall --deactivate --all`
Then STDOUT should contain:
"""
Success: Uninstalled 3 of 3 plugins.
"""
And STDERR should be empty
Scenario: Excluding a plugin from uninstallation when using --all switch
When I try `wp plugin uninstall --all --exclude=akismet,sample-plugin,hello,hello-dolly`
Then STDOUT should be:
"""
Success: No plugins uninstalled.
"""
And the return code should be 0
And STDERR should be empty
Scenario: Excluding a missing plugin should not throw an error
Given a WP install
And I run `wp plugin uninstall --all --exclude=missing-plugin`
Then STDERR should be empty
And STDOUT should contain:
"""
Success:
"""
And the return code should be 0
@require-wp-5.2
Scenario: Uninstalling a plugin should remove its language pack
Given a WP install
And I run `wp plugin install wordpress-importer`
And I run `wp core language install fr_FR`
And I run `wp site switch-language fr_FR`
When I run `wp language plugin install wordpress-importer fr_FR`
Then STDOUT should contain:
"""
Success:
"""
And the wp-content/languages/plugins/wordpress-importer-fr_FR.mo file should exist
And the wp-content/languages/plugins/wordpress-importer-fr_FR.po file should exist
And the wp-content/languages/plugins/wordpress-importer-fr_FR.l10n.php file should exist
When I run `wp plugin uninstall wordpress-importer`
Then STDOUT should contain:
"""
Success:
"""
And the wp-content/languages/plugins/wordpress-importer-fr_FR.mo file should not exist
And the wp-content/languages/plugins/wordpress-importer-fr_FR.po file should not exist
And the wp-content/languages/plugins/wordpress-importer-fr_FR.l10n.php file should not exist
And STDERR should be empty
@require-wp-5.2
Scenario: Uninstalling a plugin should remove its update info
Given a WP install
And I run `wp plugin install wordpress-importer --version=0.6`
And I run `wp plugin status wordpress-importer`
And I run `wp transient get --network update_plugins`
Then STDOUT should contain:
"""
wordpress-importer
"""
When I run `wp plugin uninstall wordpress-importer`
Then STDOUT should contain:
"""
Success:
"""
When I run `wp transient get --network update_plugins`
Then STDOUT should not contain:
"""
wordpress-importer
"""