spec\LdapTools\Operation\Handler\AuthenticationOperationHandlerSpec::it_should_authenticate_a_user_and_stay_connected_as_them_if_specified PHP Метод

it_should_authenticate_a_user_and_stay_connected_as_them_if_specified() публичный Метод

public it_should_authenticate_a_user_and_stay_connected_as_them_if_specified ( DomainConfiguration $config, $connection )
$config LdapTools\DomainConfiguration
    function it_should_authenticate_a_user_and_stay_connected_as_them_if_specified(DomainConfiguration $config, $connection)
    {
        $operation = (new AuthenticationOperation())->setUsername('foo')->setPassword('bar')->setSwitchToCredentials(true);
        $connection->connect('foo', 'bar', false, null)->willReturn($connection);
        $connection->isBound()->willReturn(true);
        $connection->close()->willReturn($connection);
        $connection->getConfig()->willReturn($config);
        // The credentials are switched in the config itself...
        $config->setUsername('foo')->shouldBeCalled();
        $config->setPassword('bar')->shouldBeCalled();
        $this->execute($operation)->shouldReturnAnInstanceOf('\\LdapTools\\Operation\\AuthenticationResponse');
    }