mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix configuration and usage of password hasher
This commit is contained in:
parent
2b3f8948f8
commit
8700352cf8
@ -16,6 +16,7 @@ use Chill\MainBundle\Repository\UserRepositoryInterface;
|
|||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -30,13 +31,12 @@ final class UserControllerTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
|
/** @var UserPasswordHasherInterface::class $passwordHasher */
|
||||||
|
$passwordHasher = self::getContainer()->get(UserPasswordHasherInterface::class);
|
||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->setUsername('Test_user '.uniqid());
|
$user->setUsername('Test_user '.uniqid());
|
||||||
$user->setPassword(self::getContainer()->get(\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface::class)->encodePassword(
|
$user->setPassword($passwordHasher->hashPassword($user, 'password'));
|
||||||
$user,
|
|
||||||
'password'
|
|
||||||
));
|
|
||||||
|
|
||||||
$em->persist($user);
|
$em->persist($user);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
@ -103,7 +103,6 @@ services:
|
|||||||
Chill\MainBundle\Form\UserPasswordType:
|
Chill\MainBundle\Form\UserPasswordType:
|
||||||
arguments:
|
arguments:
|
||||||
$chillLogger: '@monolog.logger.chill'
|
$chillLogger: '@monolog.logger.chill'
|
||||||
$passwordEncoder: '@Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface'
|
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type }
|
- { name: form.type }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user