TraceableFirewallListener example

$firewallMap = $this
            ->getMockBuilder(FirewallMap::class)
            ->disableOriginalConstructor()
            ->getMock();
        $firewallMap
            ->expects($this->once())
            ->method('getFirewallConfig')
            ->with($request)
            ->willReturn($firewallConfig);

        $collector = new SecurityDataCollector(null, null, null, null, $firewallMapnew TraceableFirewallListener($firewallMapnew EventDispatcher()new LogoutUrlGenerator()), true);
        $collector->collect($requestnew Response());
        $collector->lateCollect();
        $collected = $collector->getFirewall();

        $this->assertSame($firewallConfig->getName()$collected['name']);
        $this->assertSame($firewallConfig->getRequestMatcher()$collected['request_matcher']);
        $this->assertSame($firewallConfig->isSecurityEnabled()$collected['security_enabled']);
        $this->assertSame($firewallConfig->isStateless()$collected['stateless']);
        $this->assertSame($firewallConfig->getProvider()$collected['provider']);
        $this->assertSame($firewallConfig->getContext()$collected['context']);
        $this->assertSame($firewallConfig->getEntryPoint()$collected['entry_point']);
        
$firewallMap
            ->expects($this->once())
            ->method('getFirewallConfig')
            ->with($request)
            ->willReturn(null);
        $firewallMap
            ->expects($this->once())
            ->method('getListeners')
            ->with($request)
            ->willReturn([[$listener], null, null]);

        $firewall = new TraceableFirewallListener($firewallMapnew EventDispatcher()new LogoutUrlGenerator());
        $firewall->configureLogoutUrlGenerator($event);
        $firewall->onKernelRequest($event);

        $listeners = $firewall->getWrappedListeners();
        $this->assertCount(1, $listeners);
        $this->assertSame($listener$listeners[0]['stub']);
    }

    public function testOnKernelRequestRecordsAuthenticatorsInfo()
    {
        $request = new Request();

        
Home | Imprint | This part of the site doesn't use cookies.