Skip to content

Commit e18bffb

Browse files
committed
Merge branch '2.4'
2 parents d9ed1b9 + b1815d6 commit e18bffb

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

behat.yml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ default:
55
- 'CommandContext'
66
- 'DoctrineContext':
77
doctrine: '@doctrine'
8+
passwordEncoder: '@security.password_encoder'
89
- 'HttpHeaderContext'
910
- 'GraphqlContext'
1011
- 'JsonContext'
@@ -42,6 +43,7 @@ postgres:
4243
- 'CommandContext'
4344
- 'DoctrineContext':
4445
doctrine: '@doctrine'
46+
passwordEncoder: '@security.password_encoder'
4547
- 'HttpHeaderContext'
4648
- 'GraphqlContext'
4749
- 'JsonContext'
@@ -66,6 +68,7 @@ mongodb:
6668
- 'CommandContext'
6769
- 'DoctrineContext':
6870
doctrine: '@doctrine_mongodb'
71+
passwordEncoder: '@security.password_encoder'
6972
- 'HttpHeaderContext'
7073
- 'GraphqlContext'
7174
- 'JsonContext'
@@ -108,6 +111,7 @@ default-coverage:
108111
- 'CommandContext'
109112
- 'DoctrineContext':
110113
doctrine: '@doctrine'
114+
passwordEncoder: '@security.password_encoder'
111115
- 'HttpHeaderContext'
112116
- 'GraphqlContext'
113117
- 'JsonContext'
@@ -133,6 +137,7 @@ mongodb-coverage:
133137
- 'CommandContext'
134138
- 'DoctrineContext':
135139
doctrine: '@doctrine_mongodb'
140+
passwordEncoder: '@security.password_encoder'
136141
- 'HttpHeaderContext'
137142
- 'GraphqlContext'
138143
- 'JsonContext'

features/bootstrap/DoctrineContext.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
use Doctrine\ODM\MongoDB\DocumentManager;
128128
use Doctrine\ORM\EntityManagerInterface;
129129
use Doctrine\ORM\Tools\SchemaTool;
130+
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
130131

131132
/**
132133
* Defines application features from the specific context.
@@ -138,6 +139,7 @@ final class DoctrineContext implements Context
138139
*/
139140
private $manager;
140141
private $doctrine;
142+
private $passwordEncoder;
141143
private $schemaTool;
142144
private $schemaManager;
143145
private $classes;
@@ -149,9 +151,10 @@ final class DoctrineContext implements Context
149151
* You can also pass arbitrary arguments to the
150152
* context constructor through behat.yml.
151153
*/
152-
public function __construct(ManagerRegistry $doctrine)
154+
public function __construct(ManagerRegistry $doctrine, UserPasswordEncoderInterface $passwordEncoder)
153155
{
154156
$this->doctrine = $doctrine;
157+
$this->passwordEncoder = $passwordEncoder;
155158
$this->manager = $doctrine->getManager();
156159
$this->schemaTool = $this->manager instanceof EntityManagerInterface ? new SchemaTool($this->manager) : null;
157160
$this->schemaManager = $this->manager instanceof DocumentManager ? $this->manager->getSchemaManager() : null;
@@ -1066,8 +1069,7 @@ public function thereAreNodesInAContainer(int $nb, string $uuid)
10661069
public function thePasswordForUserShouldBeHashed(string $password, string $user)
10671070
{
10681071
$user = $this->doctrine->getRepository($this->isOrm() ? User::class : UserDocument::class)->find($user);
1069-
1070-
if (!password_verify($password, $user->getPassword())) {
1072+
if (!$this->passwordEncoder->isPasswordValid($user, $password)) {
10711073
throw new \Exception('User password mismatch');
10721074
}
10731075
}

0 commit comments

Comments
 (0)