Repository: symfony/symfony
File: src/Symfony/Component/Routing/Tests/RequestContextTest.php (PHP)

Code before:
{
    public function testConstruct()
    {
        $requestContext = new RequestContext(
            'foo',
            'post',
            'foo.bar',
            'HTTPS',
            8080,
            444,
            '/baz',
            'bar=foobar',
            [
                'foo' => 'bar',
            ]
        );

        $this->assertEquals('foo', $requestContext->getBaseUrl());
        $this->assertEquals('POST', $requestContext->getMethod());
        $this->assertEquals('foo.bar', $requestContext->getHost());
        $this->assertEquals('https', $requestContext->getScheme());
        $this->assertSame(8080, $requestContext->getHttpPort());
        $this->assertSame(444, $requestContext->getHttpsPort());
        $this->assertEquals('/baz', $requestContext->getPathInfo());
        $this->assertEquals('bar=foobar', $requestContext->getQueryString());
        $this->assertEquals(['foo' => 'bar'], $requestContext->getParameters());
    }

    public function testConstructParametersBcLayer()
    {
        $requestContext = new class() extends RequestContext {
            public function __construct()
            {
                $this->setParameters(['foo' => 'bar']);
                parent::__construct();
            }
        };

        $this->assertEquals(['foo' => 'bar'], $requestContext->getParameters());
    }

    public function testFromUriWithBaseUrl()
    {
        $requestContext = RequestContext::fromUri('https://test.com:444/index.php');

        $this->assertSame('GET', $requestContext->getMethod());
        $this->assertSame('https', $requestContext->getScheme());
        $this->assertSame('test.com', $requestContext->getHost());
        $this->assertSame('/index.php', $requestContext->getBaseUrl());
        $this->assertSame('/', $requestContext->getPathInfo());
        $this->assertSame(80, $requestContext->getHttpPort());

Review comment (suggestion):
```suggestion
        $this->assertSame(['foo' => 'bar'], $requestContext->getParameters());
```

Code after:
{
    public function testConstruct()
    {
        $requestContext = new RequestContext(
            'foo',
            'post',
            'foo.bar',
            'HTTPS',
            8080,
            444,
            '/baz',
            'bar=foobar',
            [
                'foo' => 'bar',
            ]
        );

        $this->assertEquals('foo', $requestContext->getBaseUrl());
        $this->assertEquals('POST', $requestContext->getMethod());
        $this->assertEquals('foo.bar', $requestContext->getHost());
        $this->assertEquals('https', $requestContext->getScheme());
        $this->assertSame(8080, $requestContext->getHttpPort());
        $this->assertSame(444, $requestContext->getHttpsPort());
        $this->assertEquals('/baz', $requestContext->getPathInfo());
        $this->assertEquals('bar=foobar', $requestContext->getQueryString());
        $this->assertSame(['foo' => 'bar'], $requestContext->getParameters());
    }

    public function testConstructParametersBcLayer()
    {
        $requestContext = new class() extends RequestContext {
            public function __construct()
            {
                $this->setParameters(['foo' => 'bar']);
                parent::__construct();
            }
        };

        $this->assertSame(['foo' => 'bar'], $requestContext->getParameters());
    }

    public function testFromUriWithBaseUrl()
    {
        $requestContext = RequestContext::fromUri('https://test.com:444/index.php');

        $this->assertSame('GET', $requestContext->getMethod());
        $this->assertSame('https', $requestContext->getScheme());
        $this->assertSame('test.com', $requestContext->getHost());
        $this->assertSame('/index.php', $requestContext->getBaseUrl());
        $this->assertSame('/', $requestContext->getPathInfo());
        $this->assertSame(80, $requestContext->getHttpPort());