use PHPUnit\Framework\TestCase;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\MessageDecodingFailedException;
use Symfony\Component\Messenger\Stamp\NonSendableStampInterface;
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
use Symfony\Component\Messenger\Transport\Serialization\PhpSerializer;
class PhpSerializerTest extends TestCase
{ public function testEncodedIsDecodable() { $serializer =
$this->
createPhpSerializer();
$envelope =
new Envelope(new DummyMessage('Hello'
));
$encoded =
$serializer->
encode($envelope);
$this->
assertStringNotContainsString("\0",
$encoded['body'
], 'Does not contain the binary characters'
);
$this->
assertEquals($envelope,
$serializer->
decode($encoded));
} public function testDecodingFailsWithMissingBodyKey() { $this->
expectException(MessageDecodingFailedException::
class);