Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b88230b

Browse files
bug symfony#62091 [BrowserKit] The BrowserKit history with parameter separator without slash. (biozshock)
This PR was merged into the 6.4 branch. Discussion ---------- [BrowserKit] The BrowserKit history with parameter separator without slash. | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no <!-- if yes, also update src/**/CHANGELOG.md --> | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | License | MIT When the test browser hits the page with the `?` parameters separator without the slash `/`, and next call requires query parameters, the test is failing. Commits ------- 877b5cd The BrowserKit history with parameter separator without slash.
2 parents 1a9ea3b + 877b5cd commit b88230b

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Symfony/Component/BrowserKit/AbstractBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ protected function getAbsoluteUri(string $uri): string
656656
$uri = $path.$uri;
657657
}
658658

659-
return preg_replace('#^(.*?//[^/]+)\/.*$#', '$1', $currentUri).$uri;
659+
return preg_replace('#^(.*?//[^/?]+)[/?].*$#', '$1', $currentUri).$uri;
660660
}
661661

662662
/**

src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,4 +889,13 @@ public function testInternalRequestNull()
889889

890890
$client->getInternalRequest();
891891
}
892+
893+
public function testHistoryWithParametersAndNoSlash()
894+
{
895+
$client = $this->getBrowser();
896+
$client->request('GET', 'https://www.example.com?the=value');
897+
$client->request('GET', '/path/?parameter=value');
898+
899+
$this->assertSame('https://www.example.com/path/?parameter=value', $client->getRequest()->getUri(), '->request() history provides proper base.');
900+
}
892901
}

0 commit comments

Comments
 (0)