From a674b40e94e645afc04e56d346b4fb5172eabf9d Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 10 Mar 2025 11:32:10 +0100 Subject: [PATCH 1/5] Fix some tests on WP 4.9 --- features/plugin-update.feature | 8 ++++++-- features/plugin.feature | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/features/plugin-update.feature b/features/plugin-update.feature index 56a858ad0..546f990b2 100644 --- a/features/plugin-update.feature +++ b/features/plugin-update.feature @@ -95,7 +95,8 @@ Feature: Update WordPress plugins 0.5.2 """ - @require-wp-4.0 + # Akismet currently requires WordPress 5.8 + @require-wp-5.8 Scenario: Update a plugin to its latest minor release Given a WP install And I run `wp plugin install --force akismet --version=2.5.4` @@ -196,7 +197,8 @@ Feature: Update WordPress plugins Error: Can't find the requested plugin's version 2.5.4 in the WordPress.org plugin repository (HTTP code 404). """ - @require-wp-4.7 + # Akismet currently requires WordPress 5.8 + @require-wp-5.8 Scenario: Plugin updates that error should not report a success Given a WP install And I run `wp plugin install --force akismet --version=4.0` @@ -223,6 +225,8 @@ Feature: Update WordPress plugins Success: """ + # Akismet currently requires WordPress 5.8, so there's a warning because of it. + @require-wp-5.8 Scenario: Excluding a missing plugin should not throw an error Given a WP install And I run `wp plugin update --all --exclude=missing-plugin` diff --git a/features/plugin.feature b/features/plugin.feature index 21041ec29..03a26e7eb 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -579,7 +579,8 @@ Feature: Manage WordPress plugins """ And the return code should be 0 - @require-wp-4.7 + # Akismet currently requires WordPress 5.8, so there's a warning because of it. + @require-wp-5.8 Scenario: Plugin hidden by "all_plugins" filter Given a WP install And these installed and active plugins: From 1eb501fc3d1dd7a900bfaf97f66982aac869acf6 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 10 Mar 2025 13:13:46 +0100 Subject: [PATCH 2/5] Improve transient cleanup on uninstall --- src/Plugin_Command.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index 58ceaec79..88fbb0514 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -1255,6 +1255,7 @@ public function uninstall( $args, $assoc_args = array() ) { foreach ( $deleted as $plugin_file ) { unset( $current->response[ $plugin_file ] ); + unset( $current->checked[ $plugin_file ] ); } set_site_transient( $this->upgrade_transient, $current ); From 3c05504167c7ff5a46c4e3bcbc7ebb95e8108456 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 11 Mar 2025 12:34:05 +0100 Subject: [PATCH 3/5] Bump WP requirement for 1 test --- features/plugin.feature | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/plugin.feature b/features/plugin.feature index 03a26e7eb..376edfe21 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -107,7 +107,8 @@ Feature: Manage WordPress plugins And STDOUT should be empty And the return code should be 1 - @require-wp-4.0 + # WordPress Importer currently requires at least WP 5.2. + @require-wp-5.2 Scenario: Install a plugin, activate, then force install an older version of the plugin Given a WP install From dfc3e75962ad5200c85fe6d964e53694e54bca5a Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 11 Mar 2025 12:34:09 +0100 Subject: [PATCH 4/5] Align pipes --- features/upgradables.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/upgradables.feature b/features/upgradables.feature index dee3a6272..805194ff0 100644 --- a/features/upgradables.feature +++ b/features/upgradables.feature @@ -209,5 +209,5 @@ Feature: Manage WordPress themes and plugins Examples: | type | type_name | item | item_title | version | zip_file | file_to_check | - | theme | Theme | moina | Moina | 1.1.2 | https://wordpress.org/themes/download/moina.1.1.2.zip | {CONTENT_DIR}/moina/style.css | + | theme | Theme | moina | Moina | 1.1.2 | https://wordpress.org/themes/download/moina.1.1.2.zip | {CONTENT_DIR}/moina/style.css | | plugin | Plugin | category-checklist-tree | Category Checklist Tree | 1.2 | https://downloads.wordpress.org/plugin/category-checklist-tree.1.2.zip | {CONTENT_DIR}/category-checklist-tree/category-checklist-tree.php | From 84221bdc068aade9abd490ecbea3a863c6690a2b Mon Sep 17 00:00:00 2001 From: Isla Waters Date: Wed, 19 Mar 2025 13:50:44 -0400 Subject: [PATCH 5/5] More updates to work on WordPress 4.9 Almost all of these have the same cause -- WordPress ships with Akismet but the recent versions do not work on WordPress 4.9 so commands like wp plugin list now show the updates as unavailable and with two additional table headers for requires and requires_php that explain why. So just be intentional about the fields we care about testing. --- features/plugin.feature | 8 ++++---- features/upgradables.feature | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/features/plugin.feature b/features/plugin.feature index 376edfe21..a0401d65d 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -61,7 +61,7 @@ Feature: Manage WordPress plugins When I run `wp plugin status` Then STDOUT should not be empty - When I run `wp plugin list` + When I run `wp plugin list --fields=name,status,update,version,update_version,auto_update` Then STDOUT should be a table containing rows: | name | status | update | version | update_version | auto_update | | Zombieland | active | none | 0.1.0 | | off | @@ -586,7 +586,7 @@ Feature: Manage WordPress plugins Given a WP install And these installed and active plugins: """ - akismet + hello-dolly site-secrets """ And a wp-content/mu-plugins/hide-us-plugin.php file: @@ -755,7 +755,7 @@ Feature: Manage WordPress plugins """ And I run `wp plugin activate foo` - When I run `wp plugin list` + When I run `wp plugin list --fields=name,status,update,version,update_version,auto_update` Then STDOUT should be a table containing rows: | name | status | update | version | update_version | auto_update | | foo | active | none | | | off | @@ -797,7 +797,7 @@ Feature: Manage WordPress plugins """ And I run `wp plugin activate foo` - When I run `wp plugin list` + When I run `wp plugin list --fields=name,status,update,version,update_version,auto_update` Then STDOUT should be a table containing rows: | name | status | update | version | update_version | auto_update | | foo | active | none | | | off | diff --git a/features/upgradables.feature b/features/upgradables.feature index 805194ff0..20b8459f1 100644 --- a/features/upgradables.feature +++ b/features/upgradables.feature @@ -6,6 +6,8 @@ Feature: Manage WordPress themes and plugins @require-wp-4.5 Scenario Outline: Installing, upgrading and deleting a theme or plugin Given a WP install + # Akismet ships with WordPress but does not work with older versions we test + And I run `wp plugin delete akismet` And I run `wp path` And save STDOUT as {CONTENT_DIR}