2026-03-18 22:50:23 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Tests\Controller;
|
|
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
|
|
|
|
|
|
|
|
class RegistrationControllerTest extends WebTestCase
|
|
|
|
|
{
|
|
|
|
|
public function testRegistrationPageReturnsSuccess(): void
|
|
|
|
|
{
|
|
|
|
|
$client = static::createClient();
|
|
|
|
|
$client->request('GET', '/inscription');
|
|
|
|
|
|
|
|
|
|
self::assertResponseIsSuccessful();
|
|
|
|
|
}
|
2026-03-18 23:14:04 +01:00
|
|
|
|
|
|
|
|
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 testRegistrationWithInvalidData(): void
|
|
|
|
|
{
|
|
|
|
|
$client = static::createClient();
|
|
|
|
|
$client->request('POST', '/inscription', [
|
|
|
|
|
'first_name' => '',
|
|
|
|
|
'last_name' => '',
|
|
|
|
|
'email' => 'invalid',
|
|
|
|
|
'password' => '',
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
self::assertResponseIsSuccessful();
|
|
|
|
|
}
|
2026-03-18 22:50:23 +01:00
|
|
|
}
|