Files
e-ticket/tests/Controller/EmailTrackingControllerTest.php
Serreau Jovann a9a7019a6f Fix failing controller tests: Content-Type matching, missing logo.jpg
- Use assertStringContainsString for Content-Type (Symfony adds charset)
- Create fake logo.jpg in CI for EmailTracking test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 23:04:31 +01:00

28 lines
720 B
PHP

<?php
namespace App\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class EmailTrackingControllerTest extends WebTestCase
{
public function testTrackReturnsImageResponse(): void
{
$client = static::createClient();
$projectDir = static::getContainer()->getParameter('kernel.project_dir');
$logoPath = $projectDir.'/public/logo.jpg';
if (!file_exists($logoPath)) {
file_put_contents($logoPath, 'fake-image');
}
$client->request('GET', '/track/nonexistent-id/logo.jpg');
self::assertResponseIsSuccessful();
if ('fake-image' === file_get_contents($logoPath)) {
unlink($logoPath);
}
}
}