Files
e-ticket/tests/Controller/EmailTrackingControllerTest.php
Serreau Jovann af8bbc24dc Add homepage, tarifs, legal pages, navbar, footer and full test coverage
- Homepage: hero, how it works (buyer/organizer), features, CTA
- Tarifs: 3 plans (Gratuit, Basique 10€, Sur-mesure), JSON-LD Product
- Legal pages: mentions legales, CGU (tabs buyer/organizer), CGV, RGPD, cookies, hosting
- Navbar: neubrutalism style, logo liip, mobile menu, SEO attributes
- Footer: contact, description, legal links, tarifs
- Sitemap: add /tarifs and /sitemap-orgas-{page}.xml
- Liip Imagine: remove S3, webp format on all filters
- Tests: full coverage for all controllers, services, repositories
- Fix CSP: replace inline onclick with data-tab JS

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

50 lines
1.4 KiB
PHP

<?php
namespace App\Tests\Controller;
use App\Entity\EmailTracking;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class EmailTrackingControllerTest extends WebTestCase
{
private function ensureLogoExists(): void
{
$projectDir = static::getContainer()->getParameter('kernel.project_dir');
$logoPath = $projectDir.'/public/logo.jpg';
if (!file_exists($logoPath)) {
file_put_contents($logoPath, 'fake-image');
}
}
public function testTrackReturnsImageResponse(): void
{
$client = static::createClient();
$this->ensureLogoExists();
$client->request('GET', '/track/nonexistent-id/logo.jpg');
self::assertResponseIsSuccessful();
}
public function testTrackMarksAsOpened(): void
{
$client = static::createClient();
$this->ensureLogoExists();
$em = static::getContainer()->get(EntityManagerInterface::class);
$tracking = new EmailTracking('test-track-'.uniqid(), 'user@example.com', 'Test Subject');
$em->persist($tracking);
$em->flush();
$client->request('GET', '/track/'.$tracking->getMessageId().'/logo.jpg');
self::assertResponseIsSuccessful();
$em->refresh($tracking);
self::assertSame('opened', $tracking->getState());
self::assertNotNull($tracking->getOpenedAt());
}
}