From 25a42760a16690a75a2c19e845819d0e068e06fc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 4 Sep 2025 11:31:08 +0200 Subject: [PATCH 1/5] Update tests for Hello Dolly --- features/plugin-activate.feature | 11 ++++--- features/plugin-auto-updates-disable.feature | 20 ++++++------- features/plugin-auto-updates-enable.feature | 20 ++++++------- features/plugin-auto-updates-status.feature | 30 ++++++++++---------- features/plugin-deactivate.feature | 11 +++---- features/plugin-delete.feature | 5 ++-- features/plugin-uninstall.feature | 13 +++++---- features/plugin.feature | 30 +++++++++++++------- 8 files changed, 75 insertions(+), 65 deletions(-) diff --git a/features/plugin-activate.feature b/features/plugin-activate.feature index 88ad42300..95d398503 100644 --- a/features/plugin-activate.feature +++ b/features/plugin-activate.feature @@ -21,21 +21,20 @@ Feature: Activate WordPress plugins """ And the return code should be 1 - When I try `wp plugin activate akismet hello debug-bar` + When I try `wp plugin activate akismet debug-bar` Then STDERR should be: """ Warning: The 'debug-bar' plugin could not be found. - Error: Only activated 2 of 3 plugins. + Error: Only activated 1 of 2 plugins. """ And STDOUT should be: """ Plugin 'akismet' activated. - Plugin 'hello' activated. """ And the return code should be 1 Scenario: Activate all when one plugin is hidden by "all_plugins" filter - Given I run `wp plugin install site-secrets` + Given I run `wp plugin install site-secrets https://github.com/wp-cli/sample-plugin/archive/refs/heads/master.zip` And a wp-content/mu-plugins/hide-us-plugin.php file: """ Date: Thu, 4 Sep 2025 11:58:00 +0200 Subject: [PATCH 2/5] More fixes --- features/plugin-activate.feature | 3 +++ features/plugin-deactivate.feature | 7 +++++-- features/plugin-delete.feature | 12 +++++++++--- features/plugin-uninstall.feature | 22 +++++++++++++++++----- features/plugin.feature | 7 +++++-- 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/features/plugin-activate.feature b/features/plugin-activate.feature index 95d398503..9a12ddf7a 100644 --- a/features/plugin-activate.feature +++ b/features/plugin-activate.feature @@ -54,6 +54,9 @@ Feature: Activate WordPress plugins Then STDOUT should contain: """ Plugin 'akismet' activated. + """ + And STDOUT should not contain: + """ Plugin 'sample-plugin' activated. """ And STDOUT should not contain: diff --git a/features/plugin-deactivate.feature b/features/plugin-deactivate.feature index ce5bad0f7..90aa36240 100644 --- a/features/plugin-deactivate.feature +++ b/features/plugin-deactivate.feature @@ -80,10 +80,13 @@ Feature: Deactivate WordPress plugins Scenario: Adding --exclude with plugin deactivate --all should exclude the plugins specified via --exclude When I try `wp plugin deactivate --all --exclude=sample-plugin` - Then STDOUT should be: + Then STDOUT should contain: """ Plugin 'akismet' deactivated. - Success: Deactivated 1 of 1 plugins. + """ + And STDOUT should contain: + """ + Success: Deactivated 1 of 2 plugins. """ And the return code should be 0 diff --git a/features/plugin-delete.feature b/features/plugin-delete.feature index dbdca1489..24a7c3c92 100644 --- a/features/plugin-delete.feature +++ b/features/plugin-delete.feature @@ -15,11 +15,17 @@ Feature: Delete WordPress plugins Scenario: Delete all installed plugins When I run `wp plugin delete --all` - Then STDOUT should be: + Then STDOUT should contain: """ Deleted 'akismet' plugin. + """ + And STDOUT should contain: + """ Deleted 'sample-plugin' plugin. - Success: Deleted 2 of 2 plugins. + """ + And STDOUT should contain: + """ + Success: Deleted 3 of 3 plugins. """ And the return code should be 0 @@ -42,7 +48,7 @@ Feature: Delete WordPress plugins And the return code should be 0 Scenario: Excluding a plugin from deletion when using --all switch - When I try `wp plugin delete --all --exclude=akismet,sample-plugin` + When I try `wp plugin delete --all --exclude=akismet,sample-plugin,hello,hello-dolly` Then STDOUT should be: """ Success: No plugins deleted. diff --git a/features/plugin-uninstall.feature b/features/plugin-uninstall.feature index 8c9dae03b..d912dca0e 100644 --- a/features/plugin-uninstall.feature +++ b/features/plugin-uninstall.feature @@ -85,11 +85,17 @@ Feature: Uninstall a WordPress plugin Scenario: Uninstall all installed plugins When I run `wp plugin uninstall --all` - Then STDOUT should be: + Then STDOUT should contain: """ Uninstalled and deleted 'akismet' plugin. + """ + And STDOUT should contain: + """ Uninstalled and deleted 'sample-plugin' plugin. - Success: Uninstalled 2 of 2 plugins. + """ + And STDOUT should contain: + """ + Success: Uninstalled 3 of 3 plugins. """ And the return code should be 0 And STDERR should be empty @@ -105,14 +111,20 @@ Feature: Uninstall a WordPress plugin When I run `wp plugin activate --all` Then STDOUT should contain: """ - Success: Activated 2 of 2 plugins. + Success: Activated 3 of 3 plugins. """ When I try `wp plugin uninstall --all` - Then STDERR should be: + 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 @@ -126,7 +138,7 @@ Feature: Uninstall a WordPress plugin 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` + When I try `wp plugin uninstall --all --exclude=akismet,sample-plugin,hello,hello-dolly` Then STDOUT should be: """ Success: No plugins uninstalled. diff --git a/features/plugin.feature b/features/plugin.feature index 4876c57cb..468f9483b 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -301,7 +301,7 @@ Feature: Manage WordPress plugins Scenario: List plugins Given a WP install - When I run `wp plugin activate akismet` + When I run `wp plugin activate --all` Then STDOUT should not be empty When I run `wp plugin list --status=inactive --field=name` @@ -431,9 +431,12 @@ Feature: Manage WordPress plugins Then STDOUT should contain: """ Plugin 'akismet' activated. + """ + And STDOUT should contain: + """ Plugin 'sample-plugin' activated. """ - And STDOUT should not contain: + And STDOUT should contain: """ Success: Activated 3 of 3 plugins. """ From 6bc362b84b6a0da3d2fd774c3d89c9c9fd9eb294 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 4 Sep 2025 13:47:47 +0200 Subject: [PATCH 3/5] More fixes --- features/plugin-activate.feature | 2 +- features/plugin-auto-updates-disable.feature | 2 +- features/plugin-auto-updates-enable.feature | 2 +- features/plugin-auto-updates-status.feature | 17 ++++++++++++++--- features/plugin-uninstall.feature | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/features/plugin-activate.feature b/features/plugin-activate.feature index 9a12ddf7a..9c4742441 100644 --- a/features/plugin-activate.feature +++ b/features/plugin-activate.feature @@ -55,7 +55,7 @@ Feature: Activate WordPress plugins """ Plugin 'akismet' activated. """ - And STDOUT should not contain: + And STDOUT should contain: """ Plugin 'sample-plugin' activated. """ diff --git a/features/plugin-auto-updates-disable.feature b/features/plugin-auto-updates-disable.feature index ce25d1894..af988a46b 100644 --- a/features/plugin-auto-updates-disable.feature +++ b/features/plugin-auto-updates-disable.feature @@ -54,7 +54,7 @@ Feature: Disable auto-updates for WordPress plugins """ And STDERR should contain: """ - Error: Only disabled 2 of 3 plugin auto-updates. + Error: Only disabled 3 of 4 plugin auto-updates. """ @require-wp-5.5 diff --git a/features/plugin-auto-updates-enable.feature b/features/plugin-auto-updates-enable.feature index e41ca5c88..73de4ba53 100644 --- a/features/plugin-auto-updates-enable.feature +++ b/features/plugin-auto-updates-enable.feature @@ -53,7 +53,7 @@ Feature: Enable auto-updates for WordPress plugins """ And STDERR should contain: """ - Error: Only enabled 2 of 3 plugin auto-updates. + Error: Only enabled 3 of 4 plugin auto-updates. """ @require-wp-5.5 diff --git a/features/plugin-auto-updates-status.feature b/features/plugin-auto-updates-status.feature index 8fcb77e1a..40874a2d1 100644 --- a/features/plugin-auto-updates-status.feature +++ b/features/plugin-auto-updates-status.feature @@ -86,9 +86,12 @@ Feature: Show the status of auto-updates for WordPress plugins Given I run `wp plugin auto-updates enable sample-plugin` When I run `wp plugin auto-updates status --all --disabled-only --field=name` - Then STDOUT should be: + Then STDOUT should contain: """ akismet + """ + And STDOUT should contain: + """ duplicate-post """ @@ -101,9 +104,17 @@ Feature: Show the status of auto-updates for WordPress plugins @require-wp-5.5 Scenario: Formatting options work When I run `wp plugin auto-updates status --all --format=json` - Then STDOUT should be: + Then STDOUT should contain: + """ + {"name":"akismet","status":"disabled"} + """ + And STDOUT should contain: + """ + {"name":"sample-plugin","status":"disabled"} + """ + And STDOUT should contain: """ - [{"name":"akismet","status":"disabled"},{"name":"sample-plugin","status":"disabled"},{"name":"duplicate-post","status":"disabled"}] + {"name":"duplicate-post","status":"disabled"} """ When I run `wp plugin auto-updates status --all --format=csv` diff --git a/features/plugin-uninstall.feature b/features/plugin-uninstall.feature index d912dca0e..8292fe709 100644 --- a/features/plugin-uninstall.feature +++ b/features/plugin-uninstall.feature @@ -133,7 +133,7 @@ Feature: Uninstall a WordPress plugin When I run `wp plugin uninstall --deactivate --all` Then STDOUT should contain: """ - Success: Uninstalled 2 of 2 plugins. + Success: Uninstalled 3 of 3 plugins. """ And STDERR should be empty From b109139db40ecaffd2ea2dd8cd32365536d610c5 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 4 Sep 2025 13:59:41 +0200 Subject: [PATCH 4/5] More fixes --- features/plugin-auto-updates-status.feature | 9 +++++++-- features/plugin.feature | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/features/plugin-auto-updates-status.feature b/features/plugin-auto-updates-status.feature index 40874a2d1..d4a7c424a 100644 --- a/features/plugin-auto-updates-status.feature +++ b/features/plugin-auto-updates-status.feature @@ -118,11 +118,16 @@ Feature: Show the status of auto-updates for WordPress plugins """ When I run `wp plugin auto-updates status --all --format=csv` - Then STDOUT should be: + Then STDOUT should contain: """ - name,status akismet,disabled + """ + And STDOUT should contain: + """ sample-plugin,disabled + """ + And STDOUT should contain: + """ duplicate-post,disabled """ diff --git a/features/plugin.feature b/features/plugin.feature index 468f9483b..1e5db707b 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -452,6 +452,7 @@ Feature: Manage WordPress plugins """ active active + active must-use must-use """ From 01a8c62fd459c6448fb6bbfd8240ca30ff20aeb7 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 4 Sep 2025 14:09:15 +0200 Subject: [PATCH 5/5] last one promise --- features/plugin.feature | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/plugin.feature b/features/plugin.feature index 1e5db707b..879f1e89d 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -461,9 +461,12 @@ Feature: Manage WordPress plugins Then STDOUT should contain: """ Plugin 'akismet' deactivated. + """ + And STDOUT should contain: + """ Plugin 'sample-plugin' deactivated. """ - And STDOUT should not contain: + And STDOUT should contain: """ Success: Deactivated 3 of 3 plugins. """ @@ -479,6 +482,7 @@ Feature: Manage WordPress plugins """ inactive inactive + inactive must-use must-use """