Added regression test for AccountStatusException behavior (ref #36822)

This commit is contained in:
Wouter J 2020-05-15 23:08:40 +02:00 committed by Wouter de Jong
parent 8f2c68fc60
commit 08fbfcf5a0

View File

@ -54,10 +54,16 @@ class AuthenticationProviderManagerTest extends TestCase
public function testAuthenticateWhenProviderReturnsAccountStatusException() public function testAuthenticateWhenProviderReturnsAccountStatusException()
{ {
$secondAuthenticationProvider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock();
$manager = new AuthenticationProviderManager([ $manager = new AuthenticationProviderManager([
$this->getAuthenticationProvider(true, null, 'Symfony\Component\Security\Core\Exception\AccountStatusException'), $this->getAuthenticationProvider(true, null, 'Symfony\Component\Security\Core\Exception\AccountStatusException'),
$secondAuthenticationProvider,
]); ]);
// AccountStatusException stops authentication
$secondAuthenticationProvider->expects($this->never())->method('supports');
try { try {
$manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
$this->fail(); $this->fail();