Skip to content

Commit ede5763

Browse files
schlesseraclaude
andcommitted
Use cached plugin and theme installs in tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6e0d872 commit ede5763

12 files changed

Lines changed: 201 additions & 60 deletions

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"wp-cli/entity-command": "^1.3 || ^2 || ^3",
2626
"wp-cli/language-command": "^2.0 || ^3",
2727
"wp-cli/scaffold-command": "^1.2 || ^2 || ^3",
28-
"wp-cli/wp-cli-tests": "^5"
28+
"wp-cli/wp-cli-tests": "^5.4.0"
2929
},
3030
"config": {
3131
"process-timeout": 7200,

‎features/plugin-list-wporg-status.feature‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ Feature: Check the status of plugins on WordPress.org
33
@require-wp-5.2
44
Scenario: Install plugins and check the status on wp.org.
55
Given a WP install
6-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
6+
And these installed plugins:
7+
"""
8+
wordpress-importer --version=0.5 --force
9+
"""
710
And I run `wp plugin install https://downloads.wordpress.org/plugin/no-longer-in-directory.1.0.62.zip`
811
And a wp-content/plugins/never-wporg/never-wporg.php file:
912
"""
@@ -114,7 +117,10 @@ Feature: Check the status of plugins on WordPress.org
114117
@require-wp-5.2
115118
Scenario: The wp.org last updated date for an active plugin does not depend on a second, rate-limited request
116119
Given a WP install
117-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
120+
And these installed plugins:
121+
"""
122+
wordpress-importer --version=0.5 --force
123+
"""
118124
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
119125
"""
120126
HTTP/1.1 200
@@ -146,7 +152,10 @@ Feature: Check the status of plugins on WordPress.org
146152
@require-wp-5.2
147153
Scenario: The wp.org last updated date falls back to the trac log when the plugin-info API omits it
148154
Given a WP install
149-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
155+
And these installed plugins:
156+
"""
157+
wordpress-importer --version=0.5 --force
158+
"""
150159
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
151160
"""
152161
HTTP/1.1 200
@@ -180,7 +189,10 @@ Feature: Check the status of plugins on WordPress.org
180189
@require-wp-5.2
181190
Scenario: The wp.org last updated date falls back to the trac log when the plugin-info API date can't be parsed
182191
Given a WP install
183-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
192+
And these installed plugins:
193+
"""
194+
wordpress-importer --version=0.5 --force
195+
"""
184196
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
185197
"""
186198
HTTP/1.1 200
@@ -217,7 +229,10 @@ Feature: Check the status of plugins on WordPress.org
217229
@require-wp-5.2
218230
Scenario: The wp.org last updated date stays empty when the trac log pubDate can't be parsed
219231
Given a WP install
220-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
232+
And these installed plugins:
233+
"""
234+
wordpress-importer --version=0.5 --force
235+
"""
221236
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
222237
"""
223238
HTTP/1.1 200

‎features/plugin-uninstall.feature‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ Feature: Uninstall a WordPress plugin
159159
@require-wp-5.2
160160
Scenario: Uninstalling a plugin should remove its language pack
161161
Given a WP install
162-
And I run `wp plugin install wordpress-importer`
162+
And these installed plugins:
163+
"""
164+
wordpress-importer
165+
"""
163166
And I run `wp language core install fr_FR`
164167
And I run `wp site switch-language fr_FR`
165168

@@ -185,7 +188,10 @@ Feature: Uninstall a WordPress plugin
185188
@require-wp-5.2
186189
Scenario: Uninstalling a plugin should remove its update info
187190
Given a WP install
188-
And I run `wp plugin install wordpress-importer --version=0.6`
191+
And these installed plugins:
192+
"""
193+
wordpress-importer --version=0.6
194+
"""
189195
And I try `wp plugin status wordpress-importer`
190196

191197
And I run `wp transient get --network update_plugins`

‎features/plugin-update.feature‎

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ Feature: Update WordPress plugins
8181
@require-wp-5.2
8282
Scenario: Update a plugin to its latest patch release
8383
Given a WP install
84-
And I run `wp plugin install --force wordpress-importer --version=0.5`
84+
And these installed plugins:
85+
"""
86+
wordpress-importer --version=0.5 --force
87+
"""
8588

8689
When I run `wp plugin update wordpress-importer --patch`
8790
Then STDOUT should contain:
@@ -99,7 +102,10 @@ Feature: Update WordPress plugins
99102
@require-wp-5.8
100103
Scenario: Update a plugin to its latest minor release
101104
Given a WP install
102-
And I run `wp plugin install --force akismet --version=2.5.4`
105+
And these installed plugins:
106+
"""
107+
akismet --version=2.5.4 --force
108+
"""
103109

104110
When I run `wp plugin update akismet --minor`
105111
Then STDOUT should contain:
@@ -134,7 +140,10 @@ Feature: Update WordPress plugins
134140
"""
135141

136142
# One plugin installed.
137-
Given I run `wp plugin install wordpress-importer --version=0.5 --force`
143+
Given these installed plugins:
144+
"""
145+
wordpress-importer --version=0.5 --force
146+
"""
138147

139148
When I try `wp plugin update`
140149
Then the return code should be 1
@@ -170,7 +179,10 @@ Feature: Update WordPress plugins
170179
"""
171180

172181
# Two plugins installed.
173-
Given I run `wp plugin install akismet --version=2.5.4`
182+
Given these installed plugins:
183+
"""
184+
akismet --version=2.5.4
185+
"""
174186

175187
When I run `wp plugin update --all`
176188
Then STDOUT should contain:
@@ -202,7 +214,10 @@ Feature: Update WordPress plugins
202214
@require-wp-5.8 @skip-windows
203215
Scenario: Plugin updates that error should not report a success
204216
Given a WP install
205-
And I run `wp plugin install --force akismet --version=4.0`
217+
And these installed plugins:
218+
"""
219+
akismet --version=4.0 --force
220+
"""
206221

207222
When I run `chmod -w wp-content/plugins/akismet`
208223
And I try `wp plugin update akismet`
@@ -374,7 +389,10 @@ Feature: Update WordPress plugins
374389
@require-wp-5.2 @skip-windows
375390
Scenario: Failed plugin update keeps JSON output parseable
376391
Given a WP install
377-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
392+
And these installed plugins:
393+
"""
394+
wordpress-importer --version=0.5 --force
395+
"""
378396
And I run `chmod -w wp-content/plugins/wordpress-importer`
379397

380398
When I try `wp plugin update wordpress-importer --format=json`
@@ -390,7 +408,10 @@ Feature: Update WordPress plugins
390408
@require-wp-5.2 @skip-windows
391409
Scenario: Failed plugin update keeps CSV output parseable
392410
Given a WP install
393-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
411+
And these installed plugins:
412+
"""
413+
wordpress-importer --version=0.5 --force
414+
"""
394415
And I run `chmod -w wp-content/plugins/wordpress-importer`
395416

396417
When I try `wp plugin update wordpress-importer --format=csv`
@@ -406,7 +427,10 @@ Feature: Update WordPress plugins
406427
@require-wp-5.2 @skip-windows
407428
Scenario: Skip plugin update when plugin directory is a VCS checkout
408429
Given a WP install
409-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
430+
And these installed plugins:
431+
"""
432+
wordpress-importer --version=0.5 --force
433+
"""
410434
And I run `wp plugin path wordpress-importer --dir`
411435
And save STDOUT as {PLUGIN_DIR}
412436

@@ -426,7 +450,10 @@ Feature: Update WordPress plugins
426450
@require-wp-5.2 @skip-windows
427451
Scenario: Update plugin in VCS checkout when --include-vcs is set
428452
Given a WP install
429-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
453+
And these installed plugins:
454+
"""
455+
wordpress-importer --version=0.5 --force
456+
"""
430457
And I run `wp plugin path wordpress-importer --dir`
431458
And save STDOUT as {PLUGIN_DIR}
432459

‎features/plugin.feature‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,11 @@ Feature: Manage WordPress plugins
303303
Given a WP multisite install
304304
And I run `wp plugin delete --all`
305305

306-
When I run `wp plugin install debug-bar`
307-
And I run `wp plugin install wordpress-importer --activate`
306+
Given these installed plugins:
307+
"""
308+
debug-bar
309+
"""
310+
When I run `wp plugin install wordpress-importer --activate`
308311
Then STDOUT should contain:
309312
"""
310313
Plugin 'wordpress-importer' activated.

‎features/theme-auto-update-status.feature‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ Feature: Show the status of auto-updates for WordPress themes
33
Background:
44
Given a WP install
55
And I run `wp theme delete --all --force`
6-
And I run `wp theme install twentysixteen`
7-
And I run `wp theme install twentyseventeen`
8-
And I run `wp theme install twentynineteen`
6+
And these installed themes:
7+
"""
8+
twentysixteen
9+
twentyseventeen
10+
twentynineteen
11+
"""
912

1013
@require-wp-5.5
1114
Scenario: Show an error if required params are missing

‎features/theme-auto-updates-disable.feature‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ Feature: Disable auto-updates for WordPress themes
33
Background:
44
Given a WP install
55
And I run `wp theme delete --all --force`
6-
And I run `wp theme install twentysixteen`
7-
And I run `wp theme install twentyseventeen`
8-
And I run `wp theme install twentynineteen`
6+
And these installed themes:
7+
"""
8+
twentysixteen
9+
twentyseventeen
10+
twentynineteen
11+
"""
912
And I try `wp theme auto-updates enable --all`
1013

1114
@require-wp-5.5

‎features/theme-auto-updates-enable.feature‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ Feature: Enable auto-updates for WordPress themes
33
Background:
44
Given a WP install
55
And I run `wp theme delete --all --force`
6-
And I run `wp theme install twentysixteen`
7-
And I run `wp theme install twentyseventeen`
8-
And I run `wp theme install twentynineteen`
6+
And these installed themes:
7+
"""
8+
twentysixteen
9+
twentyseventeen
10+
twentynineteen
11+
"""
912
And I try `wp theme auto-updates disable --all`
1013

1114
@require-wp-5.5

‎features/theme-check-update.feature‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ Feature: Check for theme updates
33
Scenario: Check for theme updates with no updates available
44
Given a WP install
55

6-
When I run `wp theme install twentytwelve --force`
6+
Given these installed themes:
7+
"""
8+
twentytwelve --force
9+
"""
710
# Ignore warnings if theme versions in trunk are newer than what's in the directory.
811
# This is only a temporary situation before an impending release.
912
And I try `wp theme update --all`

‎features/theme-delete.feature‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ Feature: Delete WordPress themes
33
Background:
44
Given a WP install
55
And I run `wp theme delete --all --force`
6-
And I run `wp theme install twentytwelve`
7-
And I run `wp theme install twentyeleven --activate`
6+
And these installed themes:
7+
"""
8+
twentytwelve
9+
"""
10+
And these installed and active themes:
11+
"""
12+
twentyeleven
13+
"""
814

915
Scenario: Delete an installed theme
1016
When I run `wp theme delete twentytwelve`
@@ -58,7 +64,10 @@ Feature: Delete WordPress themes
5864

5965
Scenario: Delete all installed themes when active theme has a parent
6066
Given a WP install
61-
And I run `wp theme install oceanly-green --activate`
67+
And these installed and active themes:
68+
"""
69+
oceanly-green
70+
"""
6271

6372
When I run `wp theme list --field=name`
6473
Then STDOUT should contain:

0 commit comments

Comments
 (0)