1919use Symfony \Component \Security \Core \Authentication \Token \NullToken ;
2020use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorage ;
2121use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorageInterface ;
22+ use Symfony \Component \Security \Core \Authentication \Token \TokenInterface ;
2223use Symfony \Component \Security \Core \Authentication \Token \UsernamePasswordToken ;
2324use Symfony \Component \Security \Core \Authorization \AccessDecisionManagerInterface ;
2425use Symfony \Component \Security \Core \Authorization \Voter \AuthenticatedVoter ;
2526use Symfony \Component \Security \Core \Exception \AccessDeniedException ;
27+ use Symfony \Component \Security \Core \Exception \AuthenticationCredentialsNotFoundException ;
2628use Symfony \Component \Security \Core \User \User ;
2729use Symfony \Component \Security \Http \AccessMapInterface ;
2830use Symfony \Component \Security \Http \Event \LazyResponseEvent ;
@@ -32,7 +34,7 @@ class AccessListenerTest extends TestCase
3234{
3335 public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess ()
3436 {
35- $ this ->expectException (\ Symfony \ Component \ Security \ Core \ Exception \ AccessDeniedException::class);
37+ $ this ->expectException (AccessDeniedException::class);
3638 $ request = new Request ();
3739
3840 $ accessMap = $ this ->getMockBuilder (AccessMapInterface::class)->getMock ();
@@ -43,7 +45,7 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
4345 ->willReturn ([['foo ' => 'bar ' ], null ])
4446 ;
4547
46- $ token = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
48+ $ token = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
4749 $ token
4850 ->expects ($ this ->any ())
4951 ->method ('isAuthenticated ' )
@@ -87,14 +89,14 @@ public function testHandleWhenTheTokenIsNotAuthenticated()
8789 ->willReturn ([['foo ' => 'bar ' ], null ])
8890 ;
8991
90- $ notAuthenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
92+ $ notAuthenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
9193 $ notAuthenticatedToken
9294 ->expects ($ this ->any ())
9395 ->method ('isAuthenticated ' )
9496 ->willReturn (false )
9597 ;
9698
97- $ authenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
99+ $ authenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
98100 $ authenticatedToken
99101 ->expects ($ this ->any ())
100102 ->method ('isAuthenticated ' )
@@ -151,7 +153,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest()
151153 ->willReturn ([null , null ])
152154 ;
153155
154- $ token = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
156+ $ token = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
155157 $ token
156158 ->expects ($ this ->never ())
157159 ->method ('isAuthenticated ' )
@@ -206,7 +208,7 @@ public function testHandleWhenAccessMapReturnsEmptyAttributes()
206208
207209 public function testHandleWhenTheSecurityTokenStorageHasNoToken ()
208210 {
209- $ this ->expectException (\ Symfony \ Component \ Security \ Core \ Exception \ AuthenticationCredentialsNotFoundException::class);
211+ $ this ->expectException (AuthenticationCredentialsNotFoundException::class);
210212 $ tokenStorage = $ this ->getMockBuilder (TokenStorageInterface::class)->getMock ();
211213 $ tokenStorage
212214 ->expects ($ this ->any ())
@@ -336,7 +338,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
336338 ->willReturn ([['foo ' => 'bar ' , 'bar ' => 'baz ' ], null ])
337339 ;
338340
339- $ authenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
341+ $ authenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
340342 $ authenticatedToken
341343 ->expects ($ this ->any ())
342344 ->method ('isAuthenticated ' )
@@ -358,7 +360,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
358360 $ tokenStorage ,
359361 $ accessDecisionManager ,
360362 $ accessMap ,
361- $ this ->createMock (' Symfony\Component\Security\Core\Authentication\ AuthenticationManagerInterface' )
363+ $ this ->createMock (AuthenticationManagerInterface::class )
362364 );
363365
364366 $ listener (new RequestEvent ($ this ->createMock (HttpKernelInterface::class), $ request , HttpKernelInterface::MASTER_REQUEST ));
0 commit comments