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 AmazonSqsReceiverTest extends TestCase
{ public function testItReturnsTheDecodedMessageToTheHandler() { $serializer =
$this->
createSerializer();
$sqsEnvelop =
$this->
createSqsEnvelope();
$connection =
$this->
createMock(Connection::
class);
$connection->
method('get'
)->
willReturn($sqsEnvelop);
$receiver =
new AmazonSqsReceiver($connection,
$serializer);
$actualEnvelopes =
iterator_to_array($receiver->
get());
$this->
assertCount(1,
$actualEnvelopes);
$this->
assertEquals(new DummyMessage('Hi'
),
$actualEnvelopes[0
]->
getMessage());
} public function testItRejectTheMessageIfThereIsAMessageDecodingFailedException() {