public function testItSendsTheEncodedMessage() { $envelope =
new Envelope(new DummyMessage('Oy'
));
$encoded =
['body' => '...', 'headers' =>
['type' => DummyMessage::
class]];
$serializer =
$this->
createMock(SerializerInterface::
class);
$serializer->
method('encode'
)->
with($envelope)->
willReturnOnConsecutiveCalls($encoded);
$connection =
$this->
createMock(Connection::
class);
$connection->
expects($this->
once())->
method('publish'
)->
with($encoded['body'
],
$encoded['headers'
]);
$sender =
new AmqpSender($connection,
$serializer);
$sender->
send($envelope);
} public function testItSendsTheEncodedMessageUsingARoutingKey() { $envelope =
(new Envelope(new DummyMessage('Oy'
)))->
with($stamp =
new AmqpStamp('rk'
));
$encoded =
['body' => '...', 'headers' =>
['type' => DummyMessage::
class]];
$serializer =
$this->
createMock(SerializerInterface::
class);
$serializer->
method('encode'
)->
with($envelope)->
willReturn($encoded);