Skip to content

Commit 0a3dd71

Browse files
authored
Merge pull request #473 from wp-cli/copilot/fix-broken-themes-listing
Include broken themes in `wp theme list`
2 parents ad7808f + 2717ade commit 0a3dd71

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

features/theme.feature

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,41 @@ Feature: Manage WordPress themes
435435
| moina-blog | active |
436436
| moina | parent |
437437

438+
@require-wp-5.7
439+
Scenario: List broken themes (child theme without parent)
440+
Given a WP install
441+
And I run `wp theme install moina`
442+
And I run `wp theme install moina-blog`
443+
444+
When I run `wp theme list --fields=name,status`
445+
Then STDOUT should be a table containing rows:
446+
| name | status |
447+
| moina-blog | inactive |
448+
| moina | inactive |
449+
450+
When I run `wp theme delete moina`
451+
Then STDOUT should contain:
452+
"""
453+
Deleted 'moina' theme.
454+
"""
455+
456+
When I run `wp theme list --fields=name,status`
457+
Then STDOUT should be a table containing rows:
458+
| name | status |
459+
| moina-blog | inactive |
460+
461+
When I try `wp theme activate moina-blog`
462+
Then STDERR should contain:
463+
"""
464+
Error: The parent theme is missing. Please install the "moina" parent theme.
465+
"""
466+
467+
When I try `wp theme install moina-blog`
468+
Then STDERR should contain:
469+
"""
470+
Warning: moina-blog: Theme already installed.
471+
"""
472+
438473
Scenario: When updating a theme --format should be the same when using --dry-run
439474
Given a WP install
440475
And I run `wp theme delete --all --force`

src/WP_CLI/ParseThemeNameInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function get_all_themes() {
8989
$auto_updates = [];
9090
}
9191

92-
foreach ( wp_get_themes() as $key => $theme ) {
92+
foreach ( wp_get_themes( [ 'errors' => null ] ) as $key => $theme ) {
9393
$stylesheet = $theme->get_stylesheet();
9494
$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;
9595

0 commit comments

Comments
 (0)