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 \Authorization \AccessDecisionManagerInterface ;
23+ use Symfony \Component \Security \Core \Exception \AccessDeniedException ;
24+ use Symfony \Component \Security \Core \Exception \AuthenticationCredentialsNotFoundException ;
2225use Symfony \Component \Security \Http \AccessMapInterface ;
2326use Symfony \Component \Security \Http \Event \LazyResponseEvent ;
2427use Symfony \Component \Security \Http \Firewall \AccessListener ;
@@ -27,7 +30,7 @@ class AccessListenerTest extends TestCase
2730{
2831 public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess ()
2932 {
30- $ this ->expectException (\ Symfony \ Component \ Security \ Core \ Exception \ AccessDeniedException::class);
33+ $ this ->expectException (AccessDeniedException::class);
3134 $ request = new Request ();
3235
3336 $ accessMap = $ this ->getMockBuilder (AccessMapInterface::class)->getMock ();
@@ -38,7 +41,7 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
3841 ->willReturn ([['foo ' => 'bar ' ], null ])
3942 ;
4043
41- $ token = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
44+ $ token = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
4245 $ token
4346 ->expects ($ this ->any ())
4447 ->method ('isAuthenticated ' )
@@ -82,14 +85,14 @@ public function testHandleWhenTheTokenIsNotAuthenticated()
8285 ->willReturn ([['foo ' => 'bar ' ], null ])
8386 ;
8487
85- $ notAuthenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
88+ $ notAuthenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
8689 $ notAuthenticatedToken
8790 ->expects ($ this ->any ())
8891 ->method ('isAuthenticated ' )
8992 ->willReturn (false )
9093 ;
9194
92- $ authenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
95+ $ authenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
9396 $ authenticatedToken
9497 ->expects ($ this ->any ())
9598 ->method ('isAuthenticated ' )
@@ -146,7 +149,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest()
146149 ->willReturn ([null , null ])
147150 ;
148151
149- $ token = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
152+ $ token = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
150153 $ token
151154 ->expects ($ this ->never ())
152155 ->method ('isAuthenticated ' )
@@ -201,7 +204,7 @@ public function testHandleWhenAccessMapReturnsEmptyAttributes()
201204
202205 public function testHandleWhenTheSecurityTokenStorageHasNoToken ()
203206 {
204- $ this ->expectException (\ Symfony \ Component \ Security \ Core \ Exception \ AuthenticationCredentialsNotFoundException::class);
207+ $ this ->expectException (AuthenticationCredentialsNotFoundException::class);
205208 $ tokenStorage = $ this ->getMockBuilder (TokenStorageInterface::class)->getMock ();
206209 $ tokenStorage
207210 ->expects ($ this ->any ())
@@ -241,7 +244,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
241244 ->willReturn ([['foo ' => 'bar ' , 'bar ' => 'baz ' ], null ])
242245 ;
243246
244- $ authenticatedToken = $ this ->getMockBuilder (\ Symfony \ Component \ Security \ Core \ Authentication \ Token \ TokenInterface::class)->getMock ();
247+ $ authenticatedToken = $ this ->getMockBuilder (TokenInterface::class)->getMock ();
245248 $ authenticatedToken
246249 ->expects ($ this ->any ())
247250 ->method ('isAuthenticated ' )
@@ -263,7 +266,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
263266 $ tokenStorage ,
264267 $ accessDecisionManager ,
265268 $ accessMap ,
266- $ this ->createMock (' Symfony\Component\Security\Core\Authentication\ AuthenticationManagerInterface' )
269+ $ this ->createMock (AuthenticationManagerInterface::class )
267270 );
268271
269272 $ listener (new RequestEvent ($ this ->createMock (HttpKernelInterface::class), $ request , HttpKernelInterface::MASTER_REQUEST ));
0 commit comments