Add tests for EventIndexService catch blocks when Meilisearch is unavailable

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-20 21:19:39 +01:00
parent 5fc329c2dd
commit 63a11721ee

View File

@@ -108,6 +108,28 @@ class EventIndexServiceTest extends TestCase
$this->service->removeEvent($event);
}
public function testIndexEventCatchesException(): void
{
$event = $this->createEvent();
$this->meilisearch->method('createIndexIfNotExists')
->willThrowException(new \RuntimeException('Meilisearch down'));
$this->service->indexEvent($event);
self::assertTrue(true);
}
public function testRemoveEventCatchesException(): void
{
$event = $this->createEvent();
$this->meilisearch->method('deleteDocument')
->willThrowException(new \RuntimeException('Meilisearch down'));
$this->service->removeEvent($event);
self::assertTrue(true);
}
public function testRemoveEventGlobalIndexNotExists(): void
{
$event = $this->createEvent();