getRequestRequest example

 200, ['Content-Type' => 'text/html']);
    }

    /** * Returns the routing traces associated to the given request. */
    private function getTraces(RequestDataCollector $request, string $method): array
    {
        $traceRequest = Request::create(
            $request->getPathInfo(),
            $request->getRequestServer(true)->get('REQUEST_METHOD'),
            \in_array($request->getMethod()['DELETE', 'PATCH', 'POST', 'PUT'], true) ? $request->getRequestRequest()->all() : $request->getRequestQuery()->all(),
            $request->getRequestCookies(true)->all(),
            [],
            $request->getRequestServer(true)->all()
        );

        $context = $this->matcher->getContext();
        $context->setMethod($method);
        $matcher = new TraceableUrlMatcher($this->routes, $context);
        foreach ($this->expressionLanguageProviders as $provider) {
            $matcher->addExpressionLanguageProvider($provider);
        }

        
$c->collect($request = $this->createRequest()$this->createResponse());
        $c->lateCollect();

        $attributes = $c->getRequestAttributes();

        $this->assertSame('request', $c->getName());
        $this->assertInstanceOf(ParameterBag::class$c->getRequestHeaders());
        $this->assertInstanceOf(ParameterBag::class$c->getRequestServer());
        $this->assertInstanceOf(ParameterBag::class$c->getRequestCookies());
        $this->assertInstanceOf(ParameterBag::class$attributes);
        $this->assertInstanceOf(ParameterBag::class$c->getRequestRequest());
        $this->assertInstanceOf(ParameterBag::class$c->getRequestQuery());
        $this->assertInstanceOf(ParameterBag::class$c->getResponseCookies());
        $this->assertSame('html', $c->getFormat());
        $this->assertEquals('foobar', $c->getRoute());
        $this->assertEquals(['name' => 'foo']$c->getRouteParams());
        $this->assertSame([]$c->getSessionAttributes());
        $this->assertSame('en', $c->getLocale());
        $this->assertContainsEquals(__FILE__, $attributes->get('resource'));
        $this->assertSame('stdClass', $attributes->get('object')->getType());

        $this->assertInstanceOf(ParameterBag::class$c->getResponseHeaders());
        
Home | Imprint | This part of the site doesn't use cookies.