/** * Test login */ public function login($uid) { $login = TaskerMAN\Application\Login::verifyCredentials($this->email, $this->password); $this->assertInstanceOf('TaskerMAN\\Application\\User', $login); // Verify it's returning the correct stuff $this->assertEquals($login->getID(), $uid); $this->assertEquals($login->getEmail(), $this->email); $this->assertEquals($login->getName(), $this->name); $this->assertEquals($login->isAdmin(), $this->admin); // Check API key is valid $API = TaskerMAN\Application\API::authenticateByToken($login->getAPIToken()); $this->assertTrue($API); }
/** * Check that an invalid token won't allow a user to be authenticated * Note that checking of a valid token is performed in UserCreationTest */ public function testInvalidTokenAuthentication() { $token = 'NOT-A-REAL-TOKEN'; $response = TaskerMAN\Application\API::authenticateByToken($token); $this->assertFalse($response); }