Files
e-ticket/tests/Controller/RegistrationControllerTest.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

73 lines
2.0 KiB
PHP

<?php
namespace App\Tests\Controller;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class RegistrationControllerTest extends WebTestCase
{
public function testRegistrationRedirectsWhenAuthenticated(): void
{
$client = static::createClient();
$em = static::getContainer()->get(EntityManagerInterface::class);
$user = new User();
$user->setEmail('test-reg-auth-'.uniqid().'@example.com');
$user->setFirstName('Test');
$user->setLastName('User');
$user->setPassword('$2y$13$hashed');
$em->persist($user);
$em->flush();
$client->loginUser($user);
$client->request('GET', '/inscription');
self::assertResponseRedirects();
}
public function testRegistrationPageReturnsSuccess(): void
{
$client = static::createClient();
$client->request('GET', '/inscription');
self::assertResponseIsSuccessful();
}
public function testRegistrationWithValidData(): void
{
$client = static::createClient();
$client->request('POST', '/inscription', [
'first_name' => 'Jean',
'last_name' => 'Dupont',
'email' => 'test-register-'.uniqid().'@example.com',
'password' => 'Password123!',
]);
self::assertResponseRedirects('/connexion');
}
public function testRegistrationWithDuplicateEmail(): void
{
$email = 'duplicate-'.uniqid().'@example.com';
$client = static::createClient();
$client->request('POST', '/inscription', [
'first_name' => 'Jean',
'last_name' => 'Dupont',
'email' => $email,
'password' => 'Password123!',
]);
$client->request('POST', '/inscription', [
'first_name' => 'Marie',
'last_name' => 'Martin',
'email' => $email,
'password' => 'Password456!',
]);
self::assertResponseIsSuccessful();
}
}