assertListeners example

public function testEventIsPropagated(string $configuredEvent, string $registeredEvent)
    {
        $this->container->loadFromExtension('security', [
            'firewalls' => ['main' => ['pattern' => '/', 'http_basic' => true]],
        ]);

        $this->container->register('app.security_listener', \stdClass::class)
            ->addTag('kernel.event_listener', ['method' => 'onEvent', 'event' => $configuredEvent]);

        $this->container->compile();

        $this->assertListeners([
            [$registeredEvent['app.security_listener', 'onEvent'], 0],
        ]);
    }

    public static function providePropagatedEvents(): array
    {
        return [
            [CheckPassportEvent::class, CheckPassportEvent::class],
            [LoginFailureEvent::class, LoginFailureEvent::class],
            [LoginSuccessEvent::class, LoginSuccessEvent::class],
            [LogoutEvent::class, LogoutEvent::class],
            [
Home | Imprint | This part of the site doesn't use cookies.