Skip to content

Commit 409b3f6

Browse files
Exit with 0 when checked theme is active parent theme (#327)
1 parent a877c5e commit 409b3f6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

features/theme.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,3 +659,17 @@ Feature: Manage WordPress themes
659659
Error: Parameter errors:
660660
Invalid value specified for 'status' (Filter the output by theme status.)
661661
"""
662+
663+
Scenario: Parent theme is active when its child is active
664+
Given a WP install
665+
And I run `wp theme install p2`
666+
And I run `wp theme install moina-blog --activate`
667+
668+
When I run `wp theme is-active moina-blog`
669+
Then the return code should be 0
670+
671+
When I run `wp theme is-active moina`
672+
Then the return code should be 0
673+
674+
When I try `wp theme is-active p2`
675+
Then the return code should be 1

src/Theme_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ public function is_active( $args, $assoc_args = array() ) {
731731
WP_CLI::halt( 1 );
732732
}
733733

734-
$this->is_active_theme( $theme ) ? WP_CLI::halt( 0 ) : WP_CLI::halt( 1 );
734+
$this->is_active_theme( $theme ) || $this->is_active_parent_theme( $theme ) ? WP_CLI::halt( 0 ) : WP_CLI::halt( 1 );
735735
}
736736

737737
/**

0 commit comments

Comments
 (0)