function UrlTest::testUrlFromRequestWithQueryParameters
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::testUrlFromRequestWithQueryParameters()
Tests creating a URL from a request with query parameters.
Attributes
#[DataProvider('providerUrlFromRequestWithQueryParameters')]
Parameters
array<string, string|list<string>> $queryParameters: An array of request query parameters.
File
-
core/
tests/ Drupal/ Tests/ Core/ UrlTest.php, line 164
Class
- UrlTest
- Tests Drupal\Core\Url.
Namespace
Drupal\Tests\CoreCode
public function testUrlFromRequestWithQueryParameters(array $queryParameters) : void {
$this->router
->expects($this->once())
->method('matchRequest')
->willReturn([
RouteObjectInterface::ROUTE_NAME => 'view.frontpage.page_1',
'_raw_variables' => new InputBag([]),
]);
$request = Request::create('/node', 'GET', $queryParameters);
$url = Url::createFromRequest($request);
$this->assertSame($queryParameters, $url->getOption('query'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.