diff --git a/features/comment.feature b/features/comment.feature index e5746ebb..290954e0 100644 --- a/features/comment.feature +++ b/features/comment.feature @@ -70,6 +70,16 @@ Feature: Manage WordPress comments """ And the return code should be 1 + Scenario: Updating an invalid comment should return an error + Given a WP install + + When I try `wp comment update 22 --comment_author=Foo` + Then the return code should be 1 + And STDERR should contain: + """ + Warning: Could not update comment. + """ + Scenario: Get details about an existing comment When I run `wp comment get 1` Then STDOUT should be a table containing rows: diff --git a/src/Comment_Command.php b/src/Comment_Command.php index 1ff6b361..0661ba91 100644 --- a/src/Comment_Command.php +++ b/src/Comment_Command.php @@ -118,7 +118,7 @@ public function update( $args, $assoc_args ) { $assoc_args, function ( $params ) { if ( ! wp_update_comment( $params ) ) { - return new WP_Error( 'Could not update comment.' ); + return new WP_Error( 'db_error', 'Could not update comment.' ); } return true;