2025-10-25 20:26:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Tests\MessageHandler;
|
|
|
|
|
|
2025-10-28 12:09:38 +01:00
|
|
|
use App\Message\ProcessAllWatchlist;
|
|
|
|
|
use App\Message\ProcessWatchlist;
|
|
|
|
|
use App\MessageHandler\ProcessAllWatchlistHandler;
|
2025-10-25 20:26:51 +02:00
|
|
|
use App\Tests\State\WatchlistUpdateProcessorTest;
|
|
|
|
|
use PHPUnit\Framework\Attributes\DependsExternal;
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
|
|
|
use Symfony\Component\Messenger\TraceableMessageBus;
|
|
|
|
|
|
|
|
|
|
final class ProcessWatchlistTriggerHandlerTest extends KernelTestCase
|
|
|
|
|
{
|
|
|
|
|
#[DependsExternal(WatchlistUpdateProcessorTest::class, 'testCreateWatchlist')]
|
|
|
|
|
public function testSendMessage()
|
|
|
|
|
{
|
|
|
|
|
$container = self::getContainer();
|
2025-10-28 12:09:38 +01:00
|
|
|
$handler = $container->get(ProcessAllWatchlistHandler::class);
|
2025-10-25 20:26:51 +02:00
|
|
|
|
|
|
|
|
/** @var TraceableMessageBus $bus */
|
|
|
|
|
$bus = $container->get('messenger.bus.default');
|
|
|
|
|
$bus->reset();
|
|
|
|
|
|
2025-10-28 12:09:38 +01:00
|
|
|
$handler(new ProcessAllWatchlist());
|
2025-10-25 20:26:51 +02:00
|
|
|
|
|
|
|
|
$dispatched = $bus->getDispatchedMessages();
|
|
|
|
|
$this->assertNotEmpty($dispatched);
|
2025-10-28 12:09:38 +01:00
|
|
|
$this->assertInstanceOf(ProcessWatchlist::class, $dispatched[0]['message']);
|
2025-10-25 20:26:51 +02:00
|
|
|
}
|
|
|
|
|
}
|