Commit 316b0bfc authored by catch's avatar catch

Issue #2986560 by kaythay, catch, mpdonadio: UnroutedUrlAssembler sorts Query...

Issue #2986560 by kaythay, catch, mpdonadio: UnroutedUrlAssembler sorts Query params in buildExternalUrl()

(cherry picked from commit a95fa0bd)
parent a42db5a7
......@@ -78,7 +78,6 @@ protected function buildExternalUrl($uri, array $options = [], $collect_bubbleab
$options += ['query' => []];
$options['query'] = NestedArray::mergeDeep($parsed['query'], $options['query']);
ksort($options['query']);
if ($parsed['fragment'] && !$options['fragment']) {
$options['fragment'] = '#' . $parsed['fragment'];
......
......@@ -314,7 +314,7 @@ public function testExternalUrls() {
$url = $test_url . '?drupal=awesome';
$query = ['awesome' => 'drupal'];
$result = Url::fromUri($url, ['query' => $query])->toString();
$this->assertEqual('https://www.drupal.org/?awesome=drupal&drupal=awesome', $result);
$this->assertEqual('https://www.drupal.org/?drupal=awesome&awesome=drupal', $result);
}
}
......@@ -97,8 +97,8 @@ public function providerTestAssembleWithExternalUrl() {
['https://example.com/test', ['https' => FALSE], 'http://example.com/test'],
['https://example.com/test?foo=1#bar', [], 'https://example.com/test?foo=1#bar'],
'override-query' => ['https://example.com/test?foo=1#bar', ['query' => ['foo' => 2]], 'https://example.com/test?foo=2#bar'],
'override-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => 2]], 'https://example.com/test?bar=2&foo=1#bar'],
'override-deep-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?bar%5Bbaz%5D=foo&foo=1#bar'],
'override-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => 2]], 'https://example.com/test?foo=1&bar=2#bar'],
'override-deep-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?foo=1&bar%5Bbaz%5D=foo#bar'],
'override-fragment' => ['https://example.com/test?foo=1#bar', ['fragment' => 'baz'], 'https://example.com/test?foo=1#baz'],
['//www.drupal.org', [], '//www.drupal.org'],
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment