Files
e-ticket/tests/Controller/RegistrationControllerTest.php

43 lines
1.1 KiB
PHP
Raw Normal View History

<?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();
}
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();
}
}