public function testSend() { $envelope =
new Envelope(new DummyMessage('Oy'
));
$encoded =
['body' => '...', 'headers' =>
['type' => DummyMessage::
class]];
$connection =
$this->
createMock(Connection::
class);
$connection->
expects($this->
once())->
method('send'
)->
with($encoded['body'
],
$encoded['headers'
])->
willReturn('15'
);
$serializer =
$this->
createMock(SerializerInterface::
class);
$serializer->
method('encode'
)->
with($envelope)->
willReturnOnConsecutiveCalls($encoded);
$sender =
new DoctrineSender($connection,
$serializer);
$actualEnvelope =
$sender->
send($envelope);
/** @var TransportMessageIdStamp $transportMessageIdStamp */
$transportMessageIdStamp =
$actualEnvelope->
last(TransportMessageIdStamp::
class);
$this->
assertNotNull($transportMessageIdStamp);
$this->
assertSame('15',
$transportMessageIdStamp->
getId());
} public function testSendWithDelay() { $envelope =
(new Envelope(new DummyMessage('Oy'
)))->
with(new DelayStamp(500
));