$stamp =
new class() implements StampInterface
{ };
$listener =
function DWorkerMessageReceivedEvent
$event) use ($stamp) { $event->
addStamps($stamp);
};
$eventDispatcher->
addListener(WorkerMessageReceivedEvent::
class,
$listener);
$worker =
new Worker([$receiver],
$bus,
$eventDispatcher, clock:
new MockClock());
$worker->
run();
$envelope =
current($receiver->
getAcknowledgedEnvelopes());
$this->
assertCount(1,
$envelope->
all($stamp::
class));
} public function testWorkerRateLimitMessages() { $envelope =
[ new Envelope(new DummyMessage('message1'
)),
new Envelope(new DummyMessage('message2'
)),
];
$receiver =
new DummyReceiver([$envelope]);