Skip to content

Commit

Permalink
Exit with 0 when checked theme is active parent theme (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored Sep 12, 2022
1 parent a877c5e commit 409b3f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions features/theme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -659,3 +659,17 @@ Feature: Manage WordPress themes
Error: Parameter errors:
Invalid value specified for 'status' (Filter the output by theme status.)
"""

Scenario: Parent theme is active when its child is active
Given a WP install
And I run `wp theme install p2`
And I run `wp theme install moina-blog --activate`

When I run `wp theme is-active moina-blog`
Then the return code should be 0

When I run `wp theme is-active moina`
Then the return code should be 0

When I try `wp theme is-active p2`
Then the return code should be 1
2 changes: 1 addition & 1 deletion src/Theme_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ public function is_active( $args, $assoc_args = array() ) {
WP_CLI::halt( 1 );
}

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

/**
Expand Down

0 comments on commit 409b3f6

Please sign in to comment.