From 43ac6726aa0df57cef64816ae0676d1201c1bb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Aug 2023 23:02:30 +0200 Subject: [PATCH] Fix selector button --- .../Tests/Controller/UserControllerTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php index 27a684393..843cc3022 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Tests\Controller; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; @@ -87,8 +88,9 @@ final class UserControllerTest extends WebTestCase $username = 'Test_user' . uniqid(); $password = 'Password1234!'; + // Fill in the form and submit it - $form = $crawler->selectButton('Créer')->form([ + $form = $crawler->selectButton('Créer & fermer')->form([ 'chill_mainbundle_user[username]' => $username, 'chill_mainbundle_user[plainPassword][first]' => $password, 'chill_mainbundle_user[plainPassword][second]' => $password, @@ -157,9 +159,7 @@ final class UserControllerTest extends WebTestCase $passwordEncoder = self::$container ->get(UserPasswordEncoderInterface::class); - $user = self::$kernel->getContainer() - ->get('doctrine.orm.entity_manager') - ->getRepository(\Chill\MainBundle\Entity\User::class) + $user = self::$container->get(UserRepositoryInterface::class) ->findOneBy(['username' => $username]); $this->assertTrue($passwordEncoder->isPasswordValid($user, $password));