MapQueryString example

public function testQueryDefaultValueArgument()
    {
        $payload = new RequestPayload(50);

        $validator = $this->createMock(ValidatorInterface::class);
        $validator->expects($this->never())
            ->method('validate');

        $resolver = new RequestPayloadValueResolver(new Serializer()$validator);

        $argument = new ArgumentMetadata('valid', RequestPayload::class, false, true, $payload, false, [
            MapQueryString::class => new MapQueryString(),
        ]);
        $request = Request::create('/', 'GET');

        $kernel = $this->createMock(HttpKernelInterface::class);
        $arguments = $resolver->resolve($request$argument);
        $event = new ControllerArgumentsEvent($kernelfn () => null, $arguments$request, HttpKernelInterface::MAIN_REQUEST);

        $resolver->onKernelControllerArguments($event);

        $this->assertEquals([$payload]$event->getArguments());
    }

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