admin
"""
+ When I run `wp --user=admin@example.com eval 'echo wp_get_current_user()->user_login;'`
+ Then STDOUT should be:
+ """
+ admin
+ """
+
When I try `wp --user=non-existing-user eval 'echo wp_get_current_user()->user_login;'`
Then the return code should be 1
And STDERR should be:
if ( is_numeric( $user ) ) {
$user_id = (int) $user;
+ } else if ( is_email( $user ) ) {
+ $user_obj = get_user_by( 'email', $user );
+ $user_id = ( $user_obj ) ? $user_obj->ID : 0;
} else {
$user_id = (int) username_exists( $user );
}