@@ -125,7 +125,7 @@ public function testCheckCredentialsReturningFalseFailsAuthentication()
125
125
*/
126
126
public function testCheckCredentialsReturningNonTrueFailsAuthentication ()
127
127
{
128
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\ BadCredentialsException' );
128
+ $ this ->expectException (BadCredentialsException::class );
129
129
$ providerKey = 'my_uncool_firewall ' ;
130
130
131
131
$ authenticator = $ this ->getMockBuilder (AuthenticatorInterface::class)->getMock ();
@@ -140,7 +140,7 @@ public function testCheckCredentialsReturningNonTrueFailsAuthentication()
140
140
->method ('getCredentials ' )
141
141
->willReturn ('non-null-value ' );
142
142
143
- $ mockedUser = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\ UserInterface' )->getMock ();
143
+ $ mockedUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
144
144
$ authenticator ->expects ($ this ->once ())
145
145
->method ('getUser ' )
146
146
->willReturn ($ mockedUser );
@@ -156,12 +156,12 @@ public function testCheckCredentialsReturningNonTrueFailsAuthentication()
156
156
157
157
public function testGuardWithNoLongerAuthenticatedTriggersLogout ()
158
158
{
159
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\AuthenticationExpiredException ' );
159
+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \AuthenticationExpiredException::class );
160
160
$ providerKey = 'my_firewall_abc ' ;
161
161
162
162
// create a token and mark it as NOT authenticated anymore
163
163
// this mimics what would happen if a user "changed" between request
164
- $ mockedUser = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\ UserInterface' )->getMock ();
164
+ $ mockedUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
165
165
$ token = new PostAuthenticationGuardToken ($ mockedUser , $ providerKey , ['ROLE_USER ' ]);
166
166
$ token ->setAuthenticated (false );
167
167
@@ -175,7 +175,7 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
175
175
$ authenticatorB = $ this ->getMockBuilder (AuthenticatorInterface::class)->getMock ();
176
176
$ authenticators = [$ authenticatorA , $ authenticatorB ];
177
177
178
- $ mockedUser = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\ UserInterface' )->getMock ();
178
+ $ mockedUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
179
179
$ provider = new GuardAuthenticationProvider ($ authenticators , $ this ->userProvider , 'first_firewall ' , $ this ->userChecker );
180
180
181
181
$ token = new PreAuthenticationGuardToken ($ mockedUser , 'first_firewall_1 ' );
@@ -189,12 +189,12 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
189
189
190
190
public function testAuthenticateFailsOnNonOriginatingToken ()
191
191
{
192
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\AuthenticationException ' );
192
+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \AuthenticationException::class );
193
193
$ this ->expectExceptionMessageMatches ('/second_firewall_0/ ' );
194
194
$ authenticatorA = $ this ->getMockBuilder (AuthenticatorInterface::class)->getMock ();
195
195
$ authenticators = [$ authenticatorA ];
196
196
197
- $ mockedUser = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\ UserInterface' )->getMock ();
197
+ $ mockedUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
198
198
$ provider = new GuardAuthenticationProvider ($ authenticators , $ this ->userProvider , 'first_firewall ' , $ this ->userChecker );
199
199
200
200
$ token = new PreAuthenticationGuardToken ($ mockedUser , 'second_firewall_0 ' );
@@ -203,9 +203,9 @@ public function testAuthenticateFailsOnNonOriginatingToken()
203
203
204
204
protected function setUp (): void
205
205
{
206
- $ this ->userProvider = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\UserProviderInterface ' )->getMock ();
207
- $ this ->userChecker = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\UserCheckerInterface ' )->getMock ();
208
- $ this ->preAuthenticationToken = $ this ->getMockBuilder (' Symfony\Component\Security\Guard\Token\ PreAuthenticationGuardToken' )
206
+ $ this ->userProvider = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \User \UserProviderInterface::class )->getMock ();
207
+ $ this ->userChecker = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \User \UserCheckerInterface::class )->getMock ();
208
+ $ this ->preAuthenticationToken = $ this ->getMockBuilder (PreAuthenticationGuardToken::class )
209
209
->disableOriginalConstructor ()
210
210
->getMock ();
211
211
}
0 commit comments