Fix selector button

This commit is contained in:
Julien Fastré 2023-08-02 23:02:30 +02:00
parent 0e0b0b8874
commit 43ac6726aa
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

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