/** * Test login() method with valid and invalid credentials */ public function testLogin() { $this->assertFalse($this->_auth->login('', 'admin')); // Should not throw exception $this->assertFalse($this->_auth->login('baduser', 'admin')); $this->assertFalse($this->_auth->login('admin', 'badpassword')); $this->assertTrue($this->_auth->login('admin', 'admin')); $this->assertEquals('admin', $this->_auth->getIdentity()); // clean up $this->_auth->clearIdentity(); }
/** * Log out and get back to login form * * @return \Zend\Http\Response Redirect response */ public function logoutAction() { $this->_authenticationService->clearIdentity(); return $this->redirectToRoute('login', 'login'); }