- 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>
28 lines
720 B
PHP
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);
|
|
}
|
|
}
|
|
}
|