Add missing test coverage for MeilisearchService, AnalyticsCryptoService, AccountController and AdminController
- MeilisearchServiceTest: add test for invalidateSearchCache() - AnalyticsCryptoService: mark unreachable tryDecryptJsFormat guard with @codeCoverageIgnore (decrypt already checks strlen >= 28) - AccountControllerTest: add test for tickets search query (tq param) - AdminControllerTest: add test for infra page with snapshot data file Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1256,6 +1256,20 @@ class AccountControllerTest extends WebTestCase
|
||||
self::assertResponseIsSuccessful();
|
||||
}
|
||||
|
||||
public function testEditEventStatsTabWithTicketSearch(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
$em = static::getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $this->createUser(['ROLE_ORGANIZER'], true);
|
||||
|
||||
$event = $this->createEvent($em, $user);
|
||||
|
||||
$client->loginUser($user);
|
||||
$client->request('GET', '/mon-compte/evenement/'.$event->getId().'/modifier?tab=tickets&tq=jean');
|
||||
|
||||
self::assertResponseIsSuccessful();
|
||||
}
|
||||
|
||||
public function testAddBilletPage(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
@@ -854,6 +854,38 @@ class AdminControllerTest extends WebTestCase
|
||||
self::assertResponseIsSuccessful();
|
||||
}
|
||||
|
||||
public function testInfraPageWithSnapshotData(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
$admin = $this->createUser(['ROLE_ROOT']);
|
||||
|
||||
$projectDir = static::getContainer()->getParameter('kernel.project_dir');
|
||||
$path = $projectDir.'/var/infra.json';
|
||||
$existed = file_exists($path);
|
||||
$originalContent = $existed ? file_get_contents($path) : null;
|
||||
|
||||
file_put_contents($path, json_encode([
|
||||
'server' => ['hostname' => 'test'],
|
||||
'containers' => [],
|
||||
'redis_global' => ['connected' => true],
|
||||
'redis_dbs' => [],
|
||||
'postgres' => ['connected' => true],
|
||||
'pgbouncer' => ['connected' => true],
|
||||
'generated_at' => '2026-04-01',
|
||||
]));
|
||||
|
||||
$client->loginUser($admin);
|
||||
$client->request('GET', '/admin/infra');
|
||||
|
||||
self::assertResponseIsSuccessful();
|
||||
|
||||
if ($existed) {
|
||||
file_put_contents($path, $originalContent);
|
||||
} else {
|
||||
unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
public function testInfraPageDeniedForNonRoot(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
@@ -248,6 +248,19 @@ class MeilisearchServiceTest extends TestCase
|
||||
self::assertSame(['events', 'users'], $indexes);
|
||||
}
|
||||
|
||||
public function testInvalidateSearchCache(): void
|
||||
{
|
||||
$item = $this->cache->getItem('test_key');
|
||||
$item->set('value');
|
||||
$this->cache->save($item);
|
||||
|
||||
self::assertTrue($this->cache->hasItem('test_key'));
|
||||
|
||||
$this->service->invalidateSearchCache();
|
||||
|
||||
self::assertFalse($this->cache->hasItem('test_key'));
|
||||
}
|
||||
|
||||
public function testListIndexesEmpty(): void
|
||||
{
|
||||
$response = $this->createMock(ResponseInterface::class);
|
||||
|
||||
Reference in New Issue
Block a user