Skip to content

Commit df85394

Browse files
committed
Update stubbing of getUserIdentifier
1 parent 727eb1b commit df85394

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tests/Security/Http/Authenticator/TwoFactorAuthenticatorTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
3232
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
3333
use function assert;
34-
use function method_exists;
3534

3635
class TwoFactorAuthenticatorTest extends TestCase
3736
{
@@ -125,19 +124,15 @@ private function stubRememberMeSetsTrusted(bool $rememberMeSetsTrusted): void
125124
private function createTwoFactorToken(TokenInterface|null $authenticatedToken = null, bool $allProvidersAuthenticated = false): MockObject|TwoFactorTokenInterface
126125
{
127126
$user = $this->createMock(UserInterface::class);
128-
// Compatibility for Symfony < 6.0
129-
if (method_exists(UserInterface::class, 'getUserIdentifier')) {
130-
$user
131-
->expects($this->any())
132-
->method('getUserIdentifier')
133-
->willReturn(self::USERNAME);
134-
}
135-
136127
$token = $this->createMock(TwoFactorTokenInterface::class);
137128
$token
138129
->expects($this->any())
139130
->method('getUser')
140131
->willReturn($user);
132+
$token
133+
->expects($this->any())
134+
->method('getUserIdentifier')
135+
->willReturn(self::USERNAME);
141136
$token
142137
->expects($this->any())
143138
->method('getAuthenticatedToken')

0 commit comments

Comments
 (0)