8000 [Routing] Add possibility to create a request context with parameters directly by alexander-schranz · Pull Request #60120 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Routing] Add possibility to create a request context with parameters directly #60120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: 7.4
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test about construct setParameters bc layer
  • Loading branch information
alexander-schranz committed May 26, 2025
commit c7a98f33f2068e382aae9692e3e0e50e8d406a09
13 changes: 13 additions & 0 deletions src/Symfony/Component/Routing/Tests/RequestContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ public function testConstruct()
$this->assertEquals(['foo' => 'bar'], $requestContext->getParameters());
}

public function testConstructParametersBcLayer()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what this test case is about

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its about why the if is needed for BC reasons.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lines. As the require for the bc case in this tests, other tests wouldn't catch that.

+        if ($parameters) {
            $this->parameters = $parameters;
+        }

First I wanted to trigger deprecation so we could just remove it with 8.0.

{
$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');
Expand Down
0