spec\LdapTools\Operation\Invoker\LdapOperationInvokerSpec::it_should_switch_the_server_if_the_operation_requested_it PHP Метод

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

public it_should_switch_the_server_if_the_operation_requested_it ( OperationHandler $handler, $connection, $dispatcher )
$handler LdapTools\Operation\Handler\OperationHandler
    function it_should_switch_the_server_if_the_operation_requested_it(OperationHandler $handler, $connection, $dispatcher)
    {
        $operation = (new DeleteOperation('foo'))->setServer('bar');
        $handler->supports($operation)->willReturn(true);
        $handler->setConnection($connection)->shouldBeCalled();
        $handler->setEventDispatcher($dispatcher)->shouldBeCalled();
        $handler->setOperationDefaults($operation)->shouldBeCalled();
        $handler->execute($operation)->shouldBeCalled();
        $connection->close()->shouldBeCalled();
        $connection->connect(null, null, false, 'foo')->shouldBeCalled();
        $connection->connect(null, null, false, 'bar')->shouldBeCalled();
        // Apparently this is the magic/undocumented way to say that calling this function will return X value on
        // the Nth attempt, where Nth is the argument number passed to willReturn(). *sigh* ... ridiculousness.
        $connection->getServer()->willReturn('foo', 'foo', 'foo', 'bar');
        $this->addHandler($handler);
        $this->execute($operation);
    }