class DoctrineReceiverTest extends TestCase
{ public function testItReturnsTheDecodedMessageToTheHandler() { $serializer =
$this->
createSerializer();
$doctrineEnvelope =
$this->
createDoctrineEnvelope();
$connection =
$this->
createMock(Connection::
class);
$connection->
method('get'
)->
willReturn($doctrineEnvelope);
$receiver =
new DoctrineReceiver($connection,
$serializer);
$actualEnvelopes =
$receiver->
get();
$this->
assertCount(1,
$actualEnvelopes);
/** @var Envelope $actualEnvelope */
$actualEnvelope =
$actualEnvelopes[0
];
$this->
assertEquals(new DummyMessage('Hi'
),
$actualEnvelopes[0
]->
getMessage());
/** @var DoctrineReceivedStamp $doctrineReceivedStamp */
$doctrineReceivedStamp =
$actualEnvelope->
last(DoctrineReceivedStamp::
class);
$this->
assertNotNull($doctrineReceivedStamp);
$this->
assertSame('1',
$doctrineReceivedStamp->
getId());