RouteParamsCleanupListener example


class RouteParamsCleanupListenerTest extends TestCase
{
    /** * @param array<mixed> $attributes * * @dataProvider provideListens */
    public function testListener(Request $request, array $attributes): void
    {
        $listener = new RouteParamsCleanupListener();
        $listener(new RequestEvent($this->createMock(HttpKernelInterface::class)$request, HttpKernelInterface::MAIN_REQUEST));

        static::assertSame($attributes$request->attributes->all());
    }

    public static function provideListens(): \Generator
    {
        yield 'empty' => [
            new Request(),
            [
                '_route_params' => [],
            ],
Home | Imprint | This part of the site doesn't use cookies.