From dda952d9355e3519d251f8d52b7dfee08d124bf9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:34:41 +0000 Subject: [PATCH 1/3] Initial plan From caa08b454e70bbf124937cfc657d49b899b4569c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:42:44 +0000 Subject: [PATCH 2/3] Fix broken themes not appearing in theme list Modified wp_get_themes() call to include broken themes by passing array('errors' => null) parameter Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/theme.feature | 12 ++++++++++++ src/WP_CLI/ParseThemeNameInput.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/features/theme.feature b/features/theme.feature index a604052f..b8c944b6 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -435,6 +435,18 @@ Feature: Manage WordPress themes | moina-blog | active | | moina | parent | + @require-wp-5.7 + Scenario: List broken themes (child theme without parent) + Given a WP install + And I run `wp theme install moina` + And I run `wp theme install moina-blog` + And I run `wp theme delete moina` + + When I run `wp theme list --fields=name,status` + Then STDOUT should be a table containing rows: + | name | status | + | moina-blog | inactive | + Scenario: When updating a theme --format should be the same when using --dry-run Given a WP install And I run `wp theme delete --all --force` diff --git a/src/WP_CLI/ParseThemeNameInput.php b/src/WP_CLI/ParseThemeNameInput.php index 6b6433c3..9fa61dda 100644 --- a/src/WP_CLI/ParseThemeNameInput.php +++ b/src/WP_CLI/ParseThemeNameInput.php @@ -89,7 +89,7 @@ private function get_all_themes() { $auto_updates = []; } - foreach ( wp_get_themes() as $key => $theme ) { + foreach ( wp_get_themes( array( 'errors' => null ) ) as $key => $theme ) { $stylesheet = $theme->get_stylesheet(); $update_info = ( isset( $all_update_info->response[ $stylesheet ] ) && null !== $all_update_info->response[ $theme->get_stylesheet() ] ) ? (array) $all_update_info->response[ $theme->get_stylesheet() ] : null; From e6670f0322695b774db1193eec264501c9c2db69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:44:42 +0000 Subject: [PATCH 3/3] Enhance test for broken themes scenario Added comprehensive test covering the exact scenario from the issue including attempting to install a broken theme Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/theme.feature | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/features/theme.feature b/features/theme.feature index b8c944b6..f2ea9aa0 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -440,12 +440,35 @@ Feature: Manage WordPress themes Given a WP install And I run `wp theme install moina` And I run `wp theme install moina-blog` - And I run `wp theme delete moina` - + + When I run `wp theme list --fields=name,status` + Then STDOUT should be a table containing rows: + | name | status | + | moina-blog | inactive | + | moina | inactive | + + When I run `wp theme delete moina` + Then STDOUT should contain: + """ + Deleted 'moina' theme. + """ + When I run `wp theme list --fields=name,status` Then STDOUT should be a table containing rows: | name | status | | moina-blog | inactive | + + When I try `wp theme activate moina-blog` + Then STDERR should contain: + """ + Error: The parent theme is missing. Please install the "moina" parent theme. + """ + + When I try `wp theme install moina-blog` + Then STDERR should contain: + """ + Warning: moina-blog: Theme already installed. + """ Scenario: When updating a theme --format should be the same when using --dry-run Given a WP install