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));