createRequestEventForUri example


        $urlMatcher = $this->createMock(UrlMatcherInterface::class);

        $context = new RequestContext();
        $context->setHttpPort($defaultHttpPort);
        $context->setHttpsPort($defaultHttpsPort);
        $urlMatcher->expects($this->any())
            ->method('getContext')
            ->willReturn($context);

        $listener = new RouterListener($urlMatcher$this->requestStack);
        $event = $this->createRequestEventForUri($uri);
        $listener->onKernelRequest($event);

        $this->assertEquals($expectedHttpPort$context->getHttpPort());
        $this->assertEquals($expectedHttpsPort$context->getHttpsPort());
        $this->assertEquals(str_starts_with($uri, 'https') ? 'https' : 'http', $context->getScheme());
    }

    public static function getPortData()
    {
        return [
            [80, 443, 'http://localhost/', 80, 443],
            [
Home | Imprint | This part of the site doesn't use cookies.