Skip to content

Commit 7a90da9

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Use class const in test
2 parents a752155 + 36b250a commit 7a90da9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Tests/Firewall/AccessListenerTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1919
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
2020
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
21+
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2122
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
2223
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
2324
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
25+
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
2426
use Symfony\Component\Security\Core\User\User;
2527
use Symfony\Component\Security\Http\AccessMapInterface;
2628
use 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

Comments
 (0)