Skip to content

Commit

Permalink
Merge pull request #143 from austinginder/fix-90-plugin-update-reporting
Browse files Browse the repository at this point in the history
馃悰 FIX: Failed plugin updates not throwing errors
  • Loading branch information
schlessera committed Dec 12, 2018
2 parents 8e0412d + f313ddf commit 5c7fbd9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions features/plugin-update.feature
Expand Up @@ -191,3 +191,20 @@ Feature: Update WordPress plugins
"""
Error: Can't find the requested plugin's version 2.5.4 in the WordPress.org plugin repository (HTTP code 404).
"""
@require-wp-4.7
Scenario: Plugin updates that error should not report a success
Given a WP install
And I run `wp plugin install --force akismet --version=4.0`
And I run `chmod -w wp-content/plugins/akismet`
And I try `wp plugin update akismet`
And save STDERR as {ERROR}
And I run `chmod +w wp-content/plugins/akismet`
And I run `echo "{ERROR}"`
Then STDOUT should contain:
"""
Error:
"""
1 change: 1 addition & 0 deletions features/plugin.feature
Expand Up @@ -500,6 +500,7 @@ Feature: Manage WordPress plugins
"""
And the return code should be 0

@require-wp-47
Scenario: Plugin hidden by "all_plugins" filter
Given a WP install
And these installed and active plugins:
Expand Down
3 changes: 3 additions & 0 deletions src/WP_CLI/CommandWithUpgrade.php
Expand Up @@ -401,6 +401,9 @@ protected function update_many( $args, $assoc_args ) {
'new_version' => $info['update_version'],
'status' => $result[ $info['update_id'] ] !== null ? 'Updated' : 'Error',
);
if ( null === $result[ $info['update_id'] ] ) {
$errors++;
}
}

$format = 'table';
Expand Down

0 comments on commit 5c7fbd9

Please sign in to comment.