/** * @covers ZfcUser\Authentication\Adapter\Db::Authenticate */ public function testAuthenticateWithWrongPassword() { $this->setAuthenticationCredentials(); $this->setAuthenticationUser(); $this->options->expects($this->once())->method('getEnableUserState')->will($this->returnValue(false)); $this->bcrypt->expects($this->once())->method('verify')->will($this->returnValue(false)); $this->authEvent->expects($this->once())->method('setCode')->with(\Zend\Authentication\Result::FAILURE_CREDENTIAL_INVALID)->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once(1))->method('setMessages')->with(array('Supplied credential is invalid.')); $result = $this->db->authenticate($this->authEvent); $this->assertFalse($result); $this->assertFalse($this->db->isSatisfied()); }
/** * @covers ZfcUser\Authentication\Adapter\Db::Authenticate */ public function testAuthenticateWithWrongPassword() { $this->setAuthenticationCredentials(); $this->setAuthenticationUser(); $this->options->expects($this->once())->method('getEnableUserState')->will($this->returnValue(false)); // Set lowest possible to spent the least amount of resources/time $this->options->expects($this->once())->method('getPasswordCost')->will($this->returnValue(4)); $this->authEvent->expects($this->once())->method('setCode')->with(\Zend\Authentication\Result::FAILURE_CREDENTIAL_INVALID)->will($this->returnValue($this->authEvent)); $this->authEvent->expects($this->once(1))->method('setMessages')->with(array('Supplied credential is invalid.')); $this->db->setMapper($this->mapper); $this->db->setOptions($this->options); $result = $this->db->authenticate($this->authEvent); $this->assertFalse($result); $this->assertFalse($this->db->isSatisfied()); }