function it_keeps_the_operation_in_the_buffer_if_it_fails(OperationBuffer $buffer, OperationRunner $runner, Operation $operation) { $runner->run($operation)->willThrow(new \RuntimeException('Unable to run the operation')); $buffer->current()->willReturn($operation); $this->shouldThrow(\RuntimeException::class)->duringRun($operation); $buffer->pop()->shouldNotBeCalled(); }
/** * @param Operation $operation */ public function run(Operation $operation) { $this->buffer->add($operation); while (null !== ($operation = $this->buffer->current())) { $this->runner->run($operation); $this->buffer->pop(); } }