$this->
assertCount(0,
$failureTransport->
getMessagesWaitingToBeReceived());
// receive the message - one handler will fail and the message
// will be sent back to transport1 to be retried
/*
* Receive the message from "transport1"
*/
$throwable =
$runWorker('transport1'
);
// make sure this is failing for the reason we think
$this->
assertInstanceOf(HandlerFailedException::
class,
$throwable);
// handler for transport1 and all transports were called
$this->
assertSame(1,
$transport1HandlerThatFails->
getTimesCalled());
$this->
assertSame(1,
$allTransportHandlerThatWorks->
getTimesCalled());
$this->
assertSame(0,
$transport2HandlerThatWorks->
getTimesCalled());
// one handler failed and the message is retried (resent to transport1)
$this->
assertCount(1,
$transport1->
getMessagesWaitingToBeReceived());
$this->
assertEmpty($failureTransport->
getMessagesWaitingToBeReceived());
/*
* Receive the message for a (final) retry
*/
$runWorker('transport1'
);
// only the "failed" handler is called a 2nd time