@@ -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