Skip to content

Commit 3b6e566

Browse files
derrabusnicolas-grekas
authored andcommitted
[Security][SecurityBundle] Fix deprecations triggered in tests
1 parent 32ada29 commit 3b6e566

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Tests/Functional/EventAliasTest.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,33 @@ public function testAliasedEvents()
3131
$dispatcher = $container->get('event_dispatcher');
3232

3333
$dispatcher->dispatch(new AuthenticationSuccessEvent($this->createMock(TokenInterface::class)), AuthenticationEvents::AUTHENTICATION_SUCCESS);
34-
$dispatcher->dispatch(new AuthenticationFailureEvent($this->createMock(TokenInterface::class), new AuthenticationException()), AuthenticationEvents::AUTHENTICATION_FAILURE);
3534
$dispatcher->dispatch(new InteractiveLoginEvent($this->createMock(Request::class), $this->createMock(TokenInterface::class)), SecurityEvents::INTERACTIVE_LOGIN);
3635
$dispatcher->dispatch(new SwitchUserEvent($this->createMock(Request::class), $this->createMock(UserInterface::class), $this->createMock(TokenInterface::class)), SecurityEvents::SWITCH_USER);
3736

3837
$this->assertEquals(
3938
[
4039
'onAuthenticationSuccess' => 1,
41-
'onAuthenticationFailure' => 1,
4240
'onInteractiveLogin' => 1,
4341
'onSwitchUser' => 1,
4442
],
4543
$container->get('test_subscriber')->calledMethods
4644
);
4745
}
46+
47+
/**
48+
* @group legacy
49+
*/
50+
public function testAliasedLegacyEvent()
51+
{
52+
$client = $this->createClient(['test_case' => 'AliasedEvents', 'root_config' => 'config.yml']);
53+
$container = $client->getContainer();
54+
$dispatcher = $container->get('event_dispatcher');
55+
56+
$dispatcher->dispatch(new AuthenticationFailureEvent($this->createMock(TokenInterface::class), new AuthenticationException()), AuthenticationEvents::AUTHENTICATION_FAILURE);
57+
58+
$this->assertEquals(
59+
['onAuthenticationFailure' => 1],
60+
$container->get('test_subscriber')->calledMethods
61+
);
62+
}
4863
}

0 commit comments

Comments
 (0)