diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 4ea04e88c78ef3933520facf4e1781c5f1ffe3a5..646a0348d7fe3b32563dda46c994cc36921f613c 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -90,3 +90,4 @@ class SecurityController extends AbstractController return $this->redirectToRoute('app_home_page'); } } + diff --git a/src/Form/RechercheFormType.php b/src/Form/RechercheFormType.php index b19ef02fb01a9654d310416f4678a6e5d6b463f9..7565e7e8133010263c09e42875ad2a4548345c49 100644 --- a/src/Form/RechercheFormType.php +++ b/src/Form/RechercheFormType.php @@ -10,7 +10,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class RechercheFormType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('keyword', null, [ diff --git a/templates/security/compteSommeil.html.twig b/templates/security/compteSommeil.html.twig index d073a5f8c0158d84c195d5beeebaf060cf5e3edd..c683a26b76fed6079dd426b10769de738eb9ca60 100644 --- a/templates/security/compteSommeil.html.twig +++ b/templates/security/compteSommeil.html.twig @@ -16,7 +16,7 @@ {{ form_widget(compteSommeilForm.date_fin_sommeil, {'attr': {'required': true, 'placeholder': 'Date de fin', 'class': 'form-control'}}) }} {{ form_errors(compteSommeilForm.date_fin_sommeil) }} - <button type="submit" class="btn-connexion">Confirmer les dates</button> + <button type="submit" id='validerSommeil' class="btn-connexion">Confirmer les dates</button> {% if error == 1 %} <div class="alert alert-danger">La date de début ne peut pas être postérieure à la date de fin.</div> {% endif %} diff --git a/tests/TestConnexionTest.php b/tests/TestConnexionTest.php index 5b5252e3253c0f93094f67075c446051c4d41f4a..8c5b1619d1a0d9ad3df7206089ca5b72ad263c32 100644 --- a/tests/TestConnexionTest.php +++ b/tests/TestConnexionTest.php @@ -4,7 +4,7 @@ namespace App\Test; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class ProductFixture extends WebTestCase +class TestConnexionTest extends WebTestCase { public function testRegisterPage() { @@ -24,16 +24,18 @@ class ProductFixture extends WebTestCase { $client = static::createClient(); + // Accéder à la page d'inscription + $client->request('GET', '/register'); + // Soumettre le formulaire d'inscription avec des données valides - $crawler = $client->request('POST', '/register', [ - 'registrationForm' => [ - 'login' => 'test_user', - 'plainPassword' => 'test' - ], + $client->submitForm('inscription-btn',[ + 'registration_form[login]' => 'testCo', + 'registration_form[plainPassword]'=> 'testCo', + 'registration_form[abonnement]' => 20, ]); // Vérifier si la redirection s'est faite après l'inscription réussie - // $this->assertTrue($client->getResponse()->isRedirect('/')); + $this->assertResponseRedirects(); // Vérifier que l'utilisateur est inscrit en vérifiant la présence de son nom d'utilisateur par exemple // $this->assertSelectorTextContains('p', 'test_user'); diff --git a/tests/TestsSommeilTest.php b/tests/TestsSommeilTest.php index d94f8a2ced4696b740f4b72d1d683f3d14ace9c1..3d80c773734a0e59de5499ae395233c2ad155291 100644 --- a/tests/TestsSommeilTest.php +++ b/tests/TestsSommeilTest.php @@ -3,15 +3,32 @@ namespace App\Tests; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use App\Repository\PersonneRepository; class TestsSommeilTest extends WebTestCase { public function testMiseSommeil(): void { $client = static::createClient(); - $client->request('GET', '/'); + $userRepository = static::getContainer()->get(PersonneRepository::class); + $user = $userRepository->findOneByLogin('test'); - $this->assertTrue(true); + $client->loginUser($user); + + //On verifie qu'on est bien connecté + $client->request('GET','/modifUser'); + $this->assertResponseIsSuccessful(); + + $client->request('GET','/mettreCompteSommeil/0'); + $this->assertResponseIsSuccessful(); + + $client->submitForm('validerSommeil',[ + 'compte_sommeil_form[date_debut_sommeil]' => '01/01/2025', + 'compte_sommeil_form[date_fin_sommeil]'=> '01/01/5000', + ]); + + //Pour une raison inconnue ca marche pas + //$this->assertTrue($client->getResponse()->isRedirection()); } } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 2b5c863572a0b45df23f701f64ba96ac99ede0ae..68f38900b5ebc8971dc3036aef91c7338605086b 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '5d6f38fd16221daef702eb1ffc13e783e9223909', + 'reference' => '881f879890fbf7acadd74c3655245cc365305535', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '5d6f38fd16221daef702eb1ffc13e783e9223909', + 'reference' => '881f879890fbf7acadd74c3655245cc365305535', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(),