function it_should_not_connect_before_or_after_an_authentication_operation_with_a_specific_server_set($connection)
{
$operation = (new AuthenticationOperation())->setUsername('foo')->setPassword('foo')->setServer('foo');
$connection->close()->willReturn($connection);
// One to close the original connection. Another to close the temp auth connection.
$connection->close()->shouldBeCalledTimes(2);
$connection->connect('foo', 'foo', false, 'foo')->shouldBeCalledTimes(1);
$connection->connect()->shouldBeCalledTimes(1);
// This would be called in switch server, which should not be called...
$connection->connect(null, null, false, Argument::any())->shouldNotBeCalled();
$connection->getServer()->willReturn('bar');
$this->setConnection($connection);
$this->execute($operation);
}