Skip to content

Commit a2d8100

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: Use ::class keyword when possible
2 parents 0f5e89a + 9b0abb1 commit a2d8100

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Tests/Provider/GuardAuthenticationProviderTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ public function testCheckCredentialsReturningFalseFailsAuthentication()
121121

122122
public function testGuardWithNoLongerAuthenticatedTriggersLogout()
123123
{
124-
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationExpiredException');
124+
$this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationExpiredException::class);
125125
$providerKey = 'my_firewall_abc';
126126

127127
// create a token and mark it as NOT authenticated anymore
128128
// this mimics what would happen if a user "changed" between request
129-
$mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
129+
$mockedUser = $this->getMockBuilder(UserInterface::class)->getMock();
130130
$token = new PostAuthenticationGuardToken($mockedUser, $providerKey, ['ROLE_USER']);
131131
$token->setAuthenticated(false);
132132

@@ -140,7 +140,7 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
140140
$authenticatorB = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
141141
$authenticators = [$authenticatorA, $authenticatorB];
142142

143-
$mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
143+
$mockedUser = $this->getMockBuilder(UserInterface::class)->getMock();
144144
$provider = new GuardAuthenticationProvider($authenticators, $this->userProvider, 'first_firewall', $this->userChecker);
145145

146146
$token = new PreAuthenticationGuardToken($mockedUser, 'first_firewall_1');
@@ -154,12 +154,12 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
154154

155155
public function testAuthenticateFailsOnNonOriginatingToken()
156156
{
157-
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
157+
$this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationException::class);
158158
$this->expectExceptionMessageMatches('/second_firewall_0/');
159159
$authenticatorA = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
160160
$authenticators = [$authenticatorA];
161161

162-
$mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
162+
$mockedUser = $this->getMockBuilder(UserInterface::class)->getMock();
163163
$provider = new GuardAuthenticationProvider($authenticators, $this->userProvider, 'first_firewall', $this->userChecker);
164164

165165
$token = new PreAuthenticationGuardToken($mockedUser, 'second_firewall_0');
@@ -168,9 +168,9 @@ public function testAuthenticateFailsOnNonOriginatingToken()
168168

169169
protected function setUp(): void
170170
{
171-
$this->userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
172-
$this->userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
173-
$this->preAuthenticationToken = $this->getMockBuilder('Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken')
171+
$this->userProvider = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserProviderInterface::class)->getMock();
172+
$this->userChecker = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserCheckerInterface::class)->getMock();
173+
$this->preAuthenticationToken = $this->getMockBuilder(PreAuthenticationGuardToken::class)
174174
->disableOriginalConstructor()
175175
->getMock();
176176
}

0 commit comments

Comments
 (0)