LdapTools\Operation\AuthenticationOperation::setUsername PHP Method

setUsername() public method

Set the username that will be used in the authentication operation.
public setUsername ( string $username )
$username string
    public function setUsername($username)
    {
        $this->properties['username'] = $username;
        return $this;
    }

Usage Example

Example #1
0
 function it_should_attempt_to_authenticate_a_username_and_password(LdapConnectionInterface $connection)
 {
     $operation = new AuthenticationOperation();
     $operation->setUsername('foo')->setPassword('bar');
     $response = new AuthenticationResponse(true);
     $domainConfig = new DomainConfiguration('example.local');
     $connection->getConfig()->willReturn($domainConfig);
     $connection->execute($operation)->willReturn($response);
     $this->beConstructedWith(new Configuration(), $connection);
     $this->authenticate('foo', 'bar')->shouldBeEqualTo(true);
 }