function it_should_execute_an_operation_with_the_correct_handler($dispatcher, $connection, OperationHandler $handler, QueryOperationHandler $queryHandler, DeleteOperation $operation)
{
$queryHandler->supports($operation)->willReturn(false);
$queryHandler->execute($operation)->shouldNotBeCalled();
$handler->supports($operation)->willReturn(true);
$handler->setConnection($connection)->shouldBeCalled();
$handler->setEventDispatcher($dispatcher)->shouldBeCalled();
$handler->setOperationDefaults($operation)->shouldBeCalled();
$handler->execute($operation)->shouldBeCalled();
$operation->getServer()->willReturn('foo');
$operation->getControls()->willReturn([]);
$operation->getPreOperations()->willReturn([]);
$operation->getPostOperations()->willReturn([]);
// This should not be called unless a control is explicitly set
$connection->setControl(Argument::any())->shouldNotBeCalled();
$this->addHandler($handler);
$this->addHandler($queryHandler);
$this->execute($operation);
}