// Then, expect events in new transaction to be handled next, in dispatched order:
$firstEvent,
$secondEvent,
];
$handlingMiddleware->
expects($this->
exactly(4
)) ->
method('handle'
) ->
with($this->
callback(function DEnvelope
$envelope) use (&
$series) { return $envelope->
getMessage() ===
array_shift($series);
})) ->
willReturnOnConsecutiveCalls( $this->
willHandleMessage(),
$this->
willHandleMessage(),
$this->
willHandleMessage(),
$this->
willHandleMessage() );
$messageBus->
dispatch($message);
} public function testThrowingEventsHandlingWontStopExecution() { $message =
new DummyMessage('Hello'
);