Exemple #1
0
 /**
  * Test
  **/
 public function testAuthenticateAccountWillUseAdapterFromCredential()
 {
     $credMock = $this->getMock('Void\\Account\\Credential\\Password', array('getAdapter'), array(), '', false);
     $authAdapterMock = $this->getMock('Zend\\Authentication\\Adapter\\DbTable', array(), array(), '', false);
     $credMock->expects($this->once())->method('getAdapter')->will($this->returnValue($authAdapterMock));
     $resultMock = $this->getMock('authResult', array('isValid'));
     $resultMock->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->authMock->expects($this->once())->method('authenticate')->with($authAdapterMock)->will($this->returnValue($resultMock));
     $email = '*****@*****.**';
     $account = Account::get($email);
     $account->authenticate($credMock);
 }
Exemple #2
0
 public function clearAuthentication()
 {
     if ($this->isAuthenticated()) {
         Account::getAuthenticationService()->clearIdentity();
     }
 }