Skip to content

Commit

Permalink
Merge branch '5.1' into 5.2
Browse files Browse the repository at this point in the history
* 5.1:
  Use ::class keyword when possible
  • Loading branch information
fabpot committed Jan 11, 2021
2 parents 0f5e89a + 9b0abb1 commit a2d8100
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Tests/Provider/GuardAuthenticationProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ public function testCheckCredentialsReturningFalseFailsAuthentication()

public function testGuardWithNoLongerAuthenticatedTriggersLogout()
{
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationExpiredException');
$this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationExpiredException::class);
$providerKey = 'my_firewall_abc';

// create a token and mark it as NOT authenticated anymore
// this mimics what would happen if a user "changed" between request
$mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$mockedUser = $this->getMockBuilder(UserInterface::class)->getMock();
$token = new PostAuthenticationGuardToken($mockedUser, $providerKey, ['ROLE_USER']);
$token->setAuthenticated(false);

Expand All @@ -140,7 +140,7 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()
$authenticatorB = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
$authenticators = [$authenticatorA, $authenticatorB];

$mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$mockedUser = $this->getMockBuilder(UserInterface::class)->getMock();
$provider = new GuardAuthenticationProvider($authenticators, $this->userProvider, 'first_firewall', $this->userChecker);

$token = new PreAuthenticationGuardToken($mockedUser, 'first_firewall_1');
Expand All @@ -154,12 +154,12 @@ public function testSupportsChecksGuardAuthenticatorsTokenOrigin()

public function testAuthenticateFailsOnNonOriginatingToken()
{
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
$this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationException::class);
$this->expectExceptionMessageMatches('/second_firewall_0/');
$authenticatorA = $this->getMockBuilder(AuthenticatorInterface::class)->getMock();
$authenticators = [$authenticatorA];

$mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$mockedUser = $this->getMockBuilder(UserInterface::class)->getMock();
$provider = new GuardAuthenticationProvider($authenticators, $this->userProvider, 'first_firewall', $this->userChecker);

$token = new PreAuthenticationGuardToken($mockedUser, 'second_firewall_0');
Expand All @@ -168,9 +168,9 @@ public function testAuthenticateFailsOnNonOriginatingToken()

protected function setUp(): void
{
$this->userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock();
$this->userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
$this->preAuthenticationToken = $this->getMockBuilder('Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken')
$this->userProvider = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserProviderInterface::class)->getMock();
$this->userChecker = $this->getMockBuilder(\Symfony\Component\Security\Core\User\UserCheckerInterface::class)->getMock();
$this->preAuthenticationToken = $this->getMockBuilder(PreAuthenticationGuardToken::class)
->disableOriginalConstructor()
->getMock();
}
Expand Down

0 comments on commit a2d8100

Please sign in to comment.