minor #36829 [Security] Update test to test AccountStatusException behavior (wouterj)

This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Update test to test AccountStatusException behavior

| Q             | A
| ------------- | ---
| Branch?       | 3.4 (behavior is this way since 2.0)
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

See https://github.com/symfony/symfony/pull/36822

This PR updates the `AccountStatusException` test to test the expected behavior of this exception (and its difference from `AuthenticationException`).

Commits
-------

08fbfcf5a0 Added regression test for AccountStatusException behavior (ref #36822)
This commit is contained in:
Nicolas Grekas 2020-05-16 10:33:51 +02:00
commit 30e2543b49

View File

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