1818use Symfony \Component \Security \Core \Authentication \AuthenticationManagerInterface ;
1919use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorage ;
2020use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorageInterface ;
21+ use Symfony \Component \Security \Core \Authentication \Token \TokenInterface ;
2122use Symfony \Component \Security \Core \Authentication \Token \UsernamePasswordToken ;
2223use Symfony \Component \Security \Core \Authorization \AccessDecisionManagerInterface ;
2324use Symfony \Component \Security \Core \Exception \AccessDeniedException ;
25+ use Symfony \Component \Security \Core \Exception \AuthenticationCredentialsNotFoundException ;
2426use Symfony \Component \Security \Core \User \User ;
2527use Symfony \Component \Security \Http \AccessMapInterface ;
2628use Symfony \Component \Security \Http \Event \LazyResponseEvent ;
@@ -30,7 +32,7 @@ class AccessListenerTest extends TestCase
3032{
3133 public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess ()
3234 {
33- $ this ->expectException (\ Symfony \ Component \ Security \ Core \ Exception \ AccessDeniedException::class);
35+ $ this ->expectException (AccessDeniedException::class);
3436 $ request = new Request ();
3537
3638 $ accessMap = $ this ->getMockBuilder (AccessMapInterface::class)->getMock ();
@@ -41,7 +43,7 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
4143 ->willReturn ([['foo ' => 'bar ' ], null ])
4244 ;
4345
44- $ token = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
46+ $ token = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
4547 $ token
4648 ->expects ($ this ->any ())
4749 ->method ('isAuthenticated ' )
@@ -85,14 +87,14 @@ public function testHandleWhenTheTokenIsNotAuthenticated()
8587 ->willReturn ([['foo ' => 'bar ' ], null ])
8688 ;
8789
88- $ notAuthenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
90+ $ notAuthenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
8991 $ notAuthenticatedToken
9092 ->expects ($ this ->any ())
9193 ->method ('isAuthenticated ' )
9294 ->willReturn (false )
9395 ;
9496
95- $ authenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
97+ $ authenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
9698 $ authenticatedToken
9799 ->expects ($ this ->any ())
98100 ->method ('isAuthenticated ' )
@@ -149,7 +151,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest()
149151 ->willReturn ([null , null ])
150152 ;
151153
152- $ token = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
154+ $ token = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
153155 $ token
154156 ->expects ($ this ->never ())
155157 ->method ('isAuthenticated ' )
@@ -204,7 +206,7 @@ public function testHandleWhenAccessMapReturnsEmptyAttributes()
204206
205207 public function testHandleWhenTheSecurityTokenStorageHasNoToken ()
206208 {
207- $ this ->expectException (\ Symfony \ Component \ Security \ Core \ Exception \ AuthenticationCredentialsNotFoundException::class);
209+ $ this ->expectException (AuthenticationCredentialsNotFoundException::class);
208210 $ tokenStorage = $ this ->getMockBuilder (TokenStorageInterface::class)->getMock ();
209211 $ tokenStorage
210212 ->expects ($ this ->any ())
@@ -320,7 +322,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
320322 ->willReturn ([['foo ' => 'bar ' , 'bar ' => 'baz ' ], null ])
321323 ;
322324
323- $ authenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
325+ $ authenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
324326 $ authenticatedToken
325327 ->expects ($ this ->any ())
326328 ->method ('isAuthenticated ' )
@@ -342,7 +344,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
342344 $ tokenStorage ,
343345 $ accessDecisionManager ,
344346 $ accessMap ,
345- $ this ->createMock (' Symfony\Component\Security\Core\Authentication\ AuthenticationManagerInterface' )
347+ $ this ->createMock (AuthenticationManagerInterface::class )
346348 );
347349
348350 $ listener (new RequestEvent ($ this ->createMock (HttpKernelInterface::class), $ request , HttpKernelInterface::MASTER_REQUEST ));
0 commit comments