Skip to content

Commit 8071370

Browse files
authored
Merge pull request #398 from wp-cli/fix/396-incorrect-success-on-php-requirements-mismatch
Fix counting of errors when attempting activations
2 parents 0c6b559 + d071304 commit 8071370

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

features/plugin-activate.feature

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Feature: Activate WordPress plugins
117117
*/
118118
"""
119119
And I run `wp plugin deactivate --all`
120-
And I run `php -r 'echo PHP_VERSION;'`
120+
And I run `wp cli info | grep "PHP version" | awk '{print $3}'`
121121
And save STDOUT as {PHP_VERSION}
122122

123123
When I try `wp plugin activate high-requirements`
@@ -129,6 +129,10 @@ Feature: Activate WordPress plugins
129129
"""
130130
1 out of 1
131131
"""
132+
And STDOUT should not contain:
133+
"""
134+
Success:
135+
"""
132136

133137
Scenario: Adding --exclude with plugin activate --all should exclude the plugins specified via --exclude
134138
When I try `wp plugin activate --all --exclude=hello`

src/Plugin_Command.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ public function activate( $args, $assoc_args = array() ) {
368368
$message = wp_strip_all_tags( $message );
369369
$message = str_replace( 'Error: ', '', $message );
370370
WP_CLI::warning( "Failed to activate plugin. {$message}" );
371+
++$errors;
371372
} else {
372373
$this->active_output( $plugin->name, $plugin->file, $network_wide, 'activate' );
373374
++$successes;

0 commit comments

Comments
 (0)