Skip to content

Commit c007708

Browse files
Adding tests and feedback
1 parent 5b3df74 commit c007708

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

features/user.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,4 +728,12 @@ Feature: Manage WordPress users
728728
"""
729729
newtestuser
730730
"""
731+
Scenario: Updating an invalid user should return an error
732+
Given a WP install
733+
When I try `wp user update 9999 --user_pass=securepassword`
734+
Then the return code should be 1
735+
And STDERR should contain:
736+
"""
737+
Error: No valid users found.
738+
"""
731739

src/User_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public function update( $args, $assoc_args ) {
546546
}
547547

548548
if ( empty( $user_ids ) ) {
549-
exit( 1 );
549+
WP_CLI::error( 'No valid users found.' );
550550
}
551551

552552
$skip_email = Utils\get_flag_value( $assoc_args, 'skip-email' );

0 commit comments

Comments
 (0)