final class EventAliasTest extends AbstractWebTestCase
{ public function testAliasedEvents() { $client =
$this->
createClient(['test_case' => 'AliasedEvents', 'root_config' => 'config.yml'
]);
$container =
$client->
getContainer();
$dispatcher =
$container->
get('event_dispatcher'
);
$dispatcher->
dispatch(new AuthenticationSuccessEvent($this->
createMock(TokenInterface::
class)), AuthenticationEvents::AUTHENTICATION_SUCCESS
);
$dispatcher->
dispatch(new InteractiveLoginEvent($this->
createMock(Request::
class),
$this->
createMock(TokenInterface::
class)), SecurityEvents::INTERACTIVE_LOGIN
);
$dispatcher->
dispatch(new SwitchUserEvent($this->
createMock(Request::
class),
$this->
createMock(UserInterface::
class),
$this->
createMock(TokenInterface::
class)), SecurityEvents::SWITCH_USER
);
$this->
assertEquals( [ 'onAuthenticationSuccess' => 1,
'onInteractiveLogin' => 1,
'onSwitchUser' => 1,
],
$container->
get('test_subscriber'
)->calledMethods
);
}}