Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorprogger committed Dec 7, 2024
1 parent 0f3c585 commit 8f21a91
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/Integration/MessageConsumingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@
final class MessageConsumingTest extends TestCase
{
private array $messagesProcessed;
private array $messagesProcessedSecond;

public function testMessagesConsumed(): void
{
$this->messagesProcessed = [];
$this->messagesProcessedSecond = [];

$container = $this->createMock(ContainerInterface::class);
$worker = new Worker(
['test' => fn (MessageInterface $message): mixed => $this->messagesProcessed[] = $message->getData()],
[
'test' => fn (MessageInterface $message): mixed => $this->messagesProcessed[] = $message->getData(),
'test2' => fn (MessageInterface $message): mixed => $this->messagesProcessedSecond[] = $message->getData(),
],
new NullLogger(),
new Injector($container),
$container,
Expand All @@ -37,8 +42,10 @@ public function testMessagesConsumed(): void
$messages = [1, 'foo', 'bar-baz'];
foreach ($messages as $message) {
$worker->process(new Message('test', $message), $this->getQueue());
$worker->process(new Message('test2', $message), $this->getQueue());
}

$this->assertEquals($messages, $this->messagesProcessed);
$this->assertEquals($messages, $this->messagesProcessedSecond);
}
}

0 comments on commit 8f21a91

Please sign in to comment.