function UrlAlterTest::testUrlWithQueryString

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php \Drupal\KernelTests\Core\Path\UrlAlterTest::testUrlWithQueryString()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php \Drupal\KernelTests\Core\Path\UrlAlterTest::testUrlWithQueryString()
  3. 10 core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php \Drupal\KernelTests\Core\Path\UrlAlterTest::testUrlWithQueryString()

Tests altering outbound query string.

File

core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php, line 27

Class

UrlAlterTest
Tests the capability to alter URLs.

Namespace

Drupal\KernelTests\Core\Path

Code

public function testUrlWithQueryString() : void {
  $url = Url::fromRoute('user.login');
  $this->assertEquals(\Drupal::request()->getBaseUrl() . '/user/login?foo=bar', $url->toString());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.