UrlAlterTest.php 610 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Drupal\KernelTests\Core\Path;
  3. use Drupal\Core\Url;
  4. use Drupal\KernelTests\KernelTestBase;
  5. /**
  6. * Tests the capability to alter URLs.
  7. *
  8. * @group Path
  9. *
  10. * @see \Drupal\Core\Routing\UrlGenerator::processPath
  11. */
  12. class UrlAlterTest extends KernelTestBase {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public static $modules = ['path', 'url_alter_test', 'user'];
  17. public function testUrlWithQueryString() {
  18. // Test outbound query string altering.
  19. $url = Url::fromRoute('user.login');
  20. $this->assertEquals(\Drupal::request()->getBaseUrl() . '/user/login?foo=bar', $url->toString());
  21. }
  22. }