getAbsolutePath example



    public function getAbsolutePath(): string
    {
        return $this->uri;
    }

    public function getAbsoluteUrl(): string
    {
        $scheme = $this->https ? 'https://' : 'http://';

        return $scheme . $this->host . $this->getAbsolutePath();
    }

    public function getNetworkPath(): string
    {
        return '//' . $this->host . $this->getAbsolutePath();
    }

    public function getPathInfo(): string
    {
        return $this->pathInfo;
    }
}
$this->requestStack->push($transformedRequest);

        $context = $this->getContext($transformedRequest);
        $this->router->setContext($context);

        $absolutePath = $this->router->generate($case->route);
        $absoluteUrl = $this->router->generate($case->route, [], Router::ABSOLUTE_URL);
        $networkPath = $this->router->generate($case->route, [], Router::NETWORK_PATH);
        $pathInfo = $this->router->generate($case->route, [], Router::PATH_INFO);

        static::assertSame($case->getAbsolutePath()$absolutePathvar_export($case, true));
        static::assertSame($case->getAbsoluteUrl()$absoluteUrlvar_export($case, true));
        static::assertSame($case->getNetworkPath()$networkPathvar_export($case, true));
        static::assertSame($case->getPathInfo()$pathInfovar_export($case, true));

        $matches = $this->router->matchRequest($transformedRequest);
        static::assertEquals($case->route, $matches['_route']);

        $matches = $this->router->match($transformedRequest->getPathInfo());
        static::assertEquals($case->route, $matches['_route']);

        // test seo url generation
Home | Imprint | This part of the site doesn't use cookies.