class UrlAlterTest

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

Tests the capability to alter URLs.

@group Path

Hierarchy

Expanded class hierarchy of UrlAlterTest

See also

\Drupal\Core\Routing\UrlGenerator::processPath

File

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

Namespace

Drupal\KernelTests\Core\Path
View source
class UrlAlterTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'path',
    'url_alter_test',
    'user',
  ];
  public function testUrlWithQueryString() {
    // Test outbound query string altering.
    $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.