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'
], 0
);
$serializer =
$this->
createMock(SerializerInterface::
class);
$serializer->
method('encode'
)->
with($envelope)->
willReturnOnConsecutiveCalls($encoded);
$sender =
new BeanstalkdSender($connection,
$serializer);
$sender->
send($envelope);
} public function testSendWithDelay() { $envelope =
(new Envelope(new DummyMessage('Oy'
)))->
with(new DelayStamp(500
));
$encoded =
['body' => '...', 'headers' =>
['type' => DummyMessage::
class]];
$connection =
$this->
createMock(Connection::
class);
$connection->
expects($this->
once())->
method('send'
)->
with($encoded['body'
],
$encoded['headers'
], 500
);