@@ -125,7 +125,7 @@ public function testCheckCredentialsReturningFalseFailsAuthentication()
125125 */
126126 public function testCheckCredentialsReturningNonTrueFailsAuthentication ()
127127 {
128- $ this ->expectException (' Symfony\Component\Security\Core\Exception\ BadCredentialsException' );
128+ $ this ->expectException (BadCredentialsException::class );
129129 $ providerKey = 'my_uncool_firewall ' ;
130130
131131 $ authenticator = $ this ->getMockBuilder (AuthenticatorInterface::class)->getMock ();
@@ -140,7 +140,7 @@ public function testCheckCredentialsReturningNonTrueFailsAuthentication()
140140 ->method ('getCredentials ' )
141141 ->willReturn ('non-null-value ' );
142142
143- $ mockedUser = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\ UserInterface' )->getMock ();
143+ $ mockedUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
144144 $ authenticator ->expects ($ this ->once ())
145145 ->method ('getUser ' )
146146 ->willReturn ($ mockedUser );
@@ -156,12 +156,12 @@ public function testCheckCredentialsReturningNonTrueFailsAuthentication()
156156
157157 public function testGuardWithNoLongerAuthenticatedTriggersLogout ()
158158 {
159- $ this ->expectException (' Symfony\Component\Security\Core\Exception\AuthenticationExpiredException ' );
159+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \AuthenticationExpiredException::class );
160160 $ providerKey = 'my_firewall_abc ' ;
161161
162162 // create a token and mark it as NOT authenticated anymore
163163 // 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 ();
165165 $ token = new PostAuthenticationGuardToken ($ mockedUser , $ providerKey , ['ROLE_USER ' ]);
166166 $ token ->setAuthenticated (false );
167167
@@ -175,7 +175,7 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
175175 $ authenticatorB = $ this ->getMockBuilder (AuthenticatorInterface::class)->getMock ();
176176 $ authenticators = [$ authenticatorA , $ authenticatorB ];
177177
178- $ mockedUser = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\ UserInterface' )->getMock ();
178+ $ mockedUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
179179 $ provider = new GuardAuthenticationProvider ($ authenticators , $ this ->userProvider , 'first_firewall ' , $ this ->userChecker );
180180
181181 $ token = new PreAuthenticationGuardToken ($ mockedUser , 'first_firewall_1 ' );
@@ -189,12 +189,12 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
189189
190190 public function testAuthenticateFailsOnNonOriginatingToken ()
191191 {
192- $ this ->expectException (' Symfony\Component\Security\Core\Exception\AuthenticationException ' );
192+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \AuthenticationException::class );
193193 $ this ->expectExceptionMessageMatches ('/second_firewall_0/ ' );
194194 $ authenticatorA = $ this ->getMockBuilder (AuthenticatorInterface::class)->getMock ();
195195 $ authenticators = [$ authenticatorA ];
196196
197- $ mockedUser = $ this ->getMockBuilder (' Symfony\Component\Security\Core\User\ UserInterface' )->getMock ();
197+ $ mockedUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
198198 $ provider = new GuardAuthenticationProvider ($ authenticators , $ this ->userProvider , 'first_firewall ' , $ this ->userChecker );
199199
200200 $ token = new PreAuthenticationGuardToken ($ mockedUser , 'second_firewall_0 ' );
@@ -203,9 +203,9 @@ public function testAuthenticateFailsOnNonOriginatingToken()
203203
204204 protected function setUp (): void
205205 {
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 )
209209 ->disableOriginalConstructor ()
210210 ->getMock ();
211211 }
0 commit comments