Files
e-ticket/tests/Controller/UnsubscribeControllerTest.php
Serreau Jovann dc3d464b17 Add PHPUnit tests with coverage for all src classes
- 21 test files covering controllers, services, entities, enums, messages
- CI: add test job with Xdebug coverage (clover + text)
- SonarQube: configure coverage report path and test sources

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

35 lines
911 B
PHP

<?php
namespace App\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class UnsubscribeControllerTest extends WebTestCase
{
public function testInvalidTokenReturns404(): void
{
$client = static::createClient();
$client->request('GET', '/unsubscribe/invalid-base64');
self::assertResponseStatusCodeSame(404);
}
public function testValidTokenShowsUnsubscribePage(): void
{
$client = static::createClient();
$token = base64_encode('user@example.com');
$client->request('GET', '/unsubscribe/'.$token);
self::assertResponseIsSuccessful();
}
public function testPostConfirmsUnsubscribe(): void
{
$client = static::createClient();
$token = base64_encode('user@example.com');
$client->request('POST', '/unsubscribe/'.$token);
self::assertResponseIsSuccessful();
}
}