Skip to content

Commit d786f5b

Browse files
authored
Merge branch 'main' into fix/plugin-update-unavailable-wp-requires-reason
2 parents 01b2594 + 950603b commit d786f5b

12 files changed

Lines changed: 336 additions & 119 deletions

‎.github/workflows/copilot-setup-steps.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Checkout code
24-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
24+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2525
with:
2626
persist-credentials: false
2727

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,7 @@ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file
21912191

21922192
## Support
21932193

2194-
GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
2194+
GitHub issues aren't for general support questions. For support resources and next steps, see the WP-CLI Support page: https://make.wordpress.org/cli/handbook/support/
21952195

21962196

21972197
*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*

‎features/plugin-status.feature‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Feature: List the status of plugins
88
<?php
99
"""
1010

11-
When I run `wp plugin status`
11+
When I try `wp plugin status`
1212
Then STDOUT should contain:
1313
"""
1414
D db-error.php
@@ -17,4 +17,13 @@ Feature: List the status of plugins
1717
"""
1818
D = Drop-In
1919
"""
20-
And STDERR should be empty
20+
21+
Scenario: Plugin status command is deprecated
22+
Given a WP install
23+
24+
When I try `wp plugin status`
25+
Then STDERR should contain:
26+
"""
27+
Warning: The `plugin status` command is deprecated. Use `wp plugin list` or `wp plugin get <plugin>` instead.
28+
"""
29+
And the return code should be 0

‎features/plugin-uninstall.feature‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Feature: Uninstall a WordPress plugin
160160
Scenario: Uninstalling a plugin should remove its language pack
161161
Given a WP install
162162
And I run `wp plugin install wordpress-importer`
163-
And I run `wp core language install fr_FR`
163+
And I run `wp language core install fr_FR`
164164
And I run `wp site switch-language fr_FR`
165165

166166
When I run `wp language plugin install wordpress-importer fr_FR`
@@ -186,7 +186,7 @@ Feature: Uninstall a WordPress plugin
186186
Scenario: Uninstalling a plugin should remove its update info
187187
Given a WP install
188188
And I run `wp plugin install wordpress-importer --version=0.6`
189-
And I run `wp plugin status wordpress-importer`
189+
And I try `wp plugin status wordpress-importer`
190190

191191
And I run `wp transient get --network update_plugins`
192192
Then STDOUT should contain:

‎features/plugin-update.feature‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Feature: Update WordPress plugins
6060
package from https://downloads.wordpress.org/plugin/wordpress-importer.0.5.zip...
6161
"""
6262

63-
When I run `wp plugin status wordpress-importer`
63+
When I try `wp plugin status wordpress-importer`
6464
Then STDOUT should contain:
6565
"""
6666
Update available
@@ -72,7 +72,7 @@ Feature: Update WordPress plugins
7272
wordpress-importer
7373
"""
7474

75-
When I run `wp plugin status wordpress-importer`
75+
When I try `wp plugin status wordpress-importer`
7676
Then STDOUT should contain:
7777
"""
7878
Update available
@@ -240,7 +240,7 @@ Feature: Update WordPress plugins
240240

241241
# Skipped on Windows because of sed usage that would need to be refactored for compatibility.
242242
@require-wp-5.2 @skip-windows
243-
Scenario: Updating all plugins with some of them having an invalid version shouldn't report an error
243+
Scenario: Updating all plugins ignores an older no-update version
244244
Given a WP install
245245
And I run `wp plugin delete akismet`
246246

@@ -254,20 +254,11 @@ Feature: Update WordPress plugins
254254
Then STDOUT should be empty
255255
And the return code should be 0
256256

257-
When I try `wp plugin update --all`
258-
Then STDERR should contain:
259-
"""
260-
Warning: health-check: version higher than expected.
261-
"""
262-
263-
And STDOUT should not contain:
264-
"""
265-
Error: Only updated 1 of 1 plugins.
266-
"""
267-
257+
When I run `wp plugin update --all`
258+
Then STDERR should be empty
268259
And STDOUT should contain:
269260
"""
270-
Success: Updated 1 of 1 plugins (1 skipped).
261+
Success: Updated 1 of 1 plugins.
271262
"""
272263

273264
# Tests for --auto-update-indicated feature

‎features/plugin.feature‎

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Feature: Manage WordPress plugins
55
And I run `wp plugin path`
66
And save STDOUT as {PLUGIN_DIR}
77

8-
When I run `wp plugin scaffold --skip-tests plugin1`
8+
When I run `wp scaffold plugin --skip-tests plugin1`
99
Then STDOUT should not be empty
1010
And the {PLUGIN_DIR}/plugin1/plugin1.php file should exist
1111
And the {PLUGIN_DIR}/zombieland/phpunit.xml.dist file should not exist
@@ -22,7 +22,7 @@ Feature: Manage WordPress plugins
2222
{PLUGIN_DIR}/plugin1
2323
"""
2424

25-
When I run `wp plugin scaffold Zombieland`
25+
When I run `wp scaffold plugin Zombieland`
2626
Then STDOUT should not be empty
2727
And the {PLUGIN_DIR}/Zombieland/Zombieland.php file should exist
2828
And the {PLUGIN_DIR}/Zombieland/phpunit.xml.dist file should exist
@@ -38,7 +38,7 @@ Feature: Manage WordPress plugins
3838

3939
# Check that the inner-plugin is not picked up
4040
When I run `mv {PLUGIN_DIR}/plugin1 {PLUGIN_DIR}/Zombieland/`
41-
And I run `wp plugin status Zombieland`
41+
And I try `wp plugin status Zombieland`
4242
Then STDOUT should contain:
4343
"""
4444
Plugin Zombieland details:
@@ -52,13 +52,13 @@ Feature: Manage WordPress plugins
5252
When I run `wp plugin activate Zombieland`
5353
Then STDOUT should not be empty
5454

55-
When I run `wp plugin status Zombieland`
55+
When I try `wp plugin status Zombieland`
5656
Then STDOUT should contain:
5757
"""
5858
Status: Active
5959
"""
6060

61-
When I run `wp plugin status`
61+
When I try `wp plugin status`
6262
Then STDOUT should not be empty
6363

6464
When I run `wp plugin list --fields=name,status,update,version,update_version,auto_update`
@@ -198,7 +198,7 @@ Feature: Manage WordPress plugins
198198
Success: Activated 1 of 1 plugins.
199199
"""
200200

201-
When I run `wp plugin status network-only`
201+
When I try `wp plugin status network-only`
202202
Then STDOUT should contain:
203203
"""
204204
Status: Active
@@ -220,7 +220,7 @@ Feature: Manage WordPress plugins
220220
Success: Activated 1 of 1 plugins.
221221
"""
222222

223-
When I run `wp plugin status network-only`
223+
When I try `wp plugin status network-only`
224224
Then STDOUT should contain:
225225
"""
226226
Status: Network Active
@@ -731,56 +731,58 @@ Feature: Manage WordPress plugins
731731
| db-error.php | | Custom database error message. | db-error.php |
732732

733733
@require-wp-4.0
734-
Scenario: Validate installed plugin's version.
735-
Given a WP installation
736-
And I run `wp plugin uninstall --all`
737-
And I run `wp plugin install hello-dolly --force`
738-
And a wp-content/mu-plugins/test-plugin-update.php file:
734+
Scenario Outline: Treat an older or empty no-update version as up to date
735+
Given a WP install
736+
And a wp-content/plugins/example/example.php file:
739737
"""
740738
<?php
741739
/**
742-
* Plugin Name: Test Plugin Update
743-
* Description: Fakes installed plugin's data to verify plugin version mismatch
744-
* Author: WP-CLI tests
740+
* Plugin Name: Example Plugin
741+
* Version: 2.0.0
745742
*/
743+
"""
744+
And that HTTP requests to https://api.wordpress.org/plugins/update-check/1.1/ will respond with:
745+
"""
746+
HTTP/1.1 200 OK
746747
747-
add_filter( 'site_transient_update_plugins', function( $value ) {
748-
if ( ! is_object( $value ) ) {
749-
return $value;
748+
{
749+
"plugins": [],
750+
"translations": [],
751+
"no_update": {
752+
"example/example.php": {
753+
"id": "vendor.example/plugins/example",
754+
"slug": "example",
755+
"plugin": "example/example.php",
756+
"new_version": "<upstream_version>",
757+
"package": ""
750758
}
751-
752-
unset( $value->response['hello-dolly/hello.php'] );
753-
$value->no_update['hello-dolly/hello.php']->new_version = '1.5';
754-
755-
return $value;
756-
} );
757-
?>
759+
}
760+
}
758761
"""
759762

760-
When I run `wp plugin list --name=hello-dolly --field=version`
761-
Then save STDOUT as {PLUGIN_VERSION}
762-
763-
When I run `wp plugin list --name=hello-dolly --field=update_version`
764-
Then save STDOUT as {UPDATE_VERSION}
765-
766763
When I run `wp plugin list`
767764
Then STDOUT should be a table containing rows:
768-
| name | status | update | version | update_version | auto_update |
769-
| hello-dolly | inactive | version higher than expected | {PLUGIN_VERSION} | {UPDATE_VERSION} | off |
765+
| name | status | update | version | update_version | auto_update |
766+
| example | inactive | none | 2.0.0 | | off |
770767

771-
When I try `wp plugin update --all`
772-
Then STDERR should be:
768+
When I run `wp plugin update --all`
769+
Then STDOUT should be:
773770
"""
774-
Warning: hello-dolly: version higher than expected.
775-
Error: No plugins updated.
771+
Success: Plugin already updated.
776772
"""
773+
And STDERR should be empty
777774

778-
When I try `wp plugin update hello-dolly`
779-
Then STDERR should be:
775+
When I run `wp plugin update example`
776+
Then STDOUT should be:
780777
"""
781-
Warning: hello-dolly: version higher than expected.
782-
Error: No plugins updated.
778+
Success: Plugin already updated.
783779
"""
780+
And STDERR should be empty
781+
782+
Examples:
783+
| upstream_version |
784+
| 1.0.0 |
785+
| |
784786

785787
Scenario: Only valid status filters are accepted when listing plugins
786788
Given a WP install

0 commit comments

Comments
 (0)