panelAction example

->method('render')
            ->with($expectedTemplate);

        $this
            ->createController($profiler$twig, false, array_map(function Dstring $collectorName) use ($expectedPanel$expectedTemplate): array {
                if ($collectorName === $expectedPanel) {
                    return [$expectedPanel$expectedTemplate];
                }

                return [$collectorName, 'other_template.html.twig'];
            }$collectorsNames))
            ->panelAction(new Request()$profile->getToken());
    }
}


    public function testRouteScopeListenerIgnoresSymfonyControllers(): void
    {
        $listener = $this->getContainer()->get(RouteScopeListener::class);

        $request = $this->createRequest('/api', 'api', new AdminApiSource(null, null));

        $event = $this->createEvent($request);
        /** @var ProfilerController $profilerController */
        $profilerController = $this->getContainer()->get('web_profiler.controller.profiler');
        $event->setController($profilerController->panelAction(...));

        $listener->checkScope($event);
    }

    public function testRouteScopeListenerFailsHardWithoutAnnotation(): void
    {
        $listener = $this->getContainer()->get(RouteScopeListener::class);

        $request = $this->createRequest('/api', 'api', new AdminApiSource(null, null));
        $request->attributes->remove(PlatformRequest::ATTRIBUTE_ROUTE_SCOPE);

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