Skip to content

Commit

Permalink
Merge pull request #398 from wp-cli/fix/396-incorrect-success-on-php-…
Browse files Browse the repository at this point in the history
…requirements-mismatch

Fix counting of errors when attempting activations
  • Loading branch information
swissspidy authored Feb 5, 2024
2 parents 0c6b559 + d071304 commit 8071370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion features/plugin-activate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Feature: Activate WordPress plugins
*/
"""
And I run `wp plugin deactivate --all`
And I run `php -r 'echo PHP_VERSION;'`
And I run `wp cli info | grep "PHP version" | awk '{print $3}'`
And save STDOUT as {PHP_VERSION}

When I try `wp plugin activate high-requirements`
Expand All @@ -129,6 +129,10 @@ Feature: Activate WordPress plugins
"""
1 out of 1
"""
And STDOUT should not contain:
"""
Success:
"""

Scenario: Adding --exclude with plugin activate --all should exclude the plugins specified via --exclude
When I try `wp plugin activate --all --exclude=hello`
Expand Down
1 change: 1 addition & 0 deletions src/Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ public function activate( $args, $assoc_args = array() ) {
$message = wp_strip_all_tags( $message );
$message = str_replace( 'Error: ', '', $message );
WP_CLI::warning( "Failed to activate plugin. {$message}" );
++$errors;
} else {
$this->active_output( $plugin->name, $plugin->file, $network_wide, 'activate' );
++$successes;
Expand Down

0 comments on commit 8071370

Please sign in to comment.