Files
Mangarr/tests/Domain/Scraping/Adapter/InMemoryEventBus.php
2025-02-03 10:38:53 +01:00

24 lines
534 B
PHP

<?php
namespace App\Tests\Domain\Scraping\Adapter;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\MessageBusInterface;
class InMemoryEventBus implements MessageBusInterface
{
private array $dispatchedMessages = [];
public function dispatch(object $message, array $stamps = []): Envelope
{
$this->dispatchedMessages[] = $message;
return new Envelope($message);
}
public function getDispatchedMessages(): array
{
return $this->dispatchedMessages;
}
}