use Symfony\Component\Messenger\Transport\Serialization\Serializer;
use Symfony\Component\Serializer
as SerializerComponent;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
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 */