7a8
> 	var $user_creds;
9c10,11
< 
---
> 	var $user;
> 	
12,13c14,21
< 		$this->user_id = $this->factory->user->create();
< 
---
> 		
> 		$this->user_creds = array(
> 			'user_login' => 'dorothy',
> 			'user_pass' => 'flowers',
> 			'user_email' => 'speed@metal.forum' );
> 		$this->user_id = $this->factory->user->create( $this->user_creds );
> 		$this->user = new WP_User( $this->user_id );
> 				
163a172,211
> 
> 	function testLoginWithUsername() {
> 		$authed_user = wp_authenticate( $this->user_creds['user_login'], $this->user_creds['user_pass'] );
> 		$this->assertEquals( $this->user, $authed_user );
> 	}
> 	
> 	function testLoginWithEmail() {
> 		$email_authed_user = wp_authenticate( $this->user_creds['user_email'], $this->user_creds['user_pass'] );
> 		$this->assertEquals( $this->user, $email_authed_user );
> 	}
> 
> 	function testLoginWithEmptyUsernameAndPassword() {
> 		$he_came_too_soon = wp_authenticate( '', '' );
> 		$this->assertInstanceOf( 'WP_Error', $he_came_too_soon );
> 		$this->assertObjectHasAttribute( 'errors', $he_came_too_soon );
> 		$this->assertTrue( isset( $he_came_too_soon->errors['empty_username'] ) );
> 		$this->assertTrue( isset( $he_came_too_soon->errors['empty_password'] ) );
> 	}
> 	
> 	function testLoginWithWrongUsername() {
> 		$mr_x = wp_authenticate( 'wrong', $this->user_creds['user_pass'] );
> 		$this->assertInstanceOf( 'WP_Error', $mr_x );
> 		$this->assertObjectHasAttribute( 'errors', $mr_x );
> 		$this->assertTrue( isset( $mr_x->errors['invalid_username'] ) );
> 	}
> 
> 	function testLoginWithWrongEmail() {
> 		$mr_x = wp_authenticate( 'so@wrong.com', $this->user_creds['user_pass'] );
> 		$this->assertInstanceOf( 'WP_Error', $mr_x );
> 		$this->assertObjectHasAttribute( 'errors', $mr_x );
> 		$this->assertTrue( isset( $mr_x->errors['invalid_email'] ) );
> 	}
> 
> 	function testLoginWithWrongPassword() {
> 		$forgetful = wp_authenticate( $this->user_creds['user_login'], 'abc' );
> 		$this->assertInstanceOf( 'WP_Error', $forgetful );
> 		$this->assertObjectHasAttribute( 'errors', $forgetful );
> 		$this->assertTrue( isset( $forgetful->errors['incorrect_password'] ) );
> 	}
> 
