- 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>
35 lines
911 B
PHP
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();
|
|
}
|
|
}
|