public function testCheckAuthenticationUnknownUserPasswordIs0() { $method = $this->setMethodAccessible('checkAuthentication'); $username = '******'; $password = '******'; $user = new TestUser(); $user->setUsername($username); $token = new UsernamePasswordToken($username, $password, 'provider_key', array()); $this->ldapManager->expects($this->once())->method('bind')->with($this->equalTo($user), $this->equalTo($password))->will($this->returnValue(true)); $method->invoke($this->ldapAuthenticationProvider, $user, $token); $this->assertTrue(true); }
public function testNoViolationsOnUniqueUserProperty() { $this->ldapManagerMock->expects($this->once())->method('findUserByUsername')->will($this->returnValue(null))->with($this->equalTo($this->user->getUsername())); $this->validatorContext->expects($this->never())->method('addViolation'); $this->validator->validate($this->user, $this->constraint); }
public function testTrueOnUniqueUserProperty() { $this->ldapManagerMock->expects($this->once())->method('findUserByUsername')->will($this->returnValue(null))->with($this->equalTo($this->user->getUsername())); $this->assertTrue($this->validator->isValid($this->user, $this->constraint)); }