Add test for Meilisearch organizer sync coverage

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-19 19:34:01 +01:00
parent 82829f6240
commit b1912f4362

View File

@@ -116,6 +116,27 @@ class AdminControllerTest extends WebTestCase
self::assertResponseRedirects('/admin'); self::assertResponseRedirects('/admin');
} }
public function testSyncMeilisearchWithOrganizers(): void
{
$client = static::createClient();
$em = static::getContainer()->get(EntityManagerInterface::class);
$admin = $this->createUser(['ROLE_ROOT']);
$orga = $this->createOrganizer($em);
$orga->setIsApproved(true);
$em->flush();
$meilisearch = $this->createMock(MeilisearchService::class);
$meilisearch->expects(self::exactly(2))->method('createIndexIfNotExists');
$meilisearch->expects(self::exactly(2))->method('addDocuments');
static::getContainer()->set(MeilisearchService::class, $meilisearch);
$client->loginUser($admin);
$client->request('POST', '/admin/sync-meilisearch');
self::assertResponseRedirects('/admin');
}
public function testBuyersSearchWithMeilisearchError(): void public function testBuyersSearchWithMeilisearchError(): void
{ {
$client = static::createClient(); $client = static::createClient();