// handling fails again, message is sent to failure transport
$this->
assertCount(0,
$transport1->
getMessagesWaitingToBeReceived());
$this->
assertCount(1,
$failureTransport->
getMessagesWaitingToBeReceived());
/** @var Envelope $failedEnvelope */
$failedEnvelope =
$failureTransport->
getMessagesWaitingToBeReceived()[0
];
/** @var SentToFailureTransportStamp $sentToFailureStamp */
$sentToFailureStamp =
$failedEnvelope->
last(SentToFailureTransportStamp::
class);
$this->
assertNotNull($sentToFailureStamp);
/** @var ErrorDetailsStamp $errorDetailsStamp */
$errorDetailsStamp =
$failedEnvelope->
last(ErrorDetailsStamp::
class);
$this->
assertNotNull($errorDetailsStamp);
$this->
assertSame('Failure from call 2',
$errorDetailsStamp->
getExceptionMessage());
/*
* Failed message is handled, fails, and sent for a retry
*/
$throwable =
$runWorker('the_failure_transport'
);
// make sure this is failing for the reason we think
$this->
assertInstanceOf(HandlerFailedException::
class,
$throwable);
// only the "failed" handler is called a 3rd time
$this->
assertSame(3,
$transport1HandlerThatFails->
getTimesCalled());
$this->
assertSame(1,
$allTransportHandlerThatWorks->
getTimesCalled());
// handling fails again, message is retried