UrlAlterTest.php

Same filename in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php
  3. 11.x core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php

Namespace

Drupal\KernelTests\Core\Path

File

core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\KernelTests\Core\Path;

use Drupal\Core\Url;
use Drupal\KernelTests\KernelTestBase;

/**
 * Tests the capability to alter URLs.
 *
 * @group Path
 *
 * @see \Drupal\Core\Routing\UrlGenerator::processPath
 */
class UrlAlterTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'path',
        'url_alter_test',
        'user',
    ];
    public function testUrlWithQueryString() : void {
        // Test outbound query string altering.
        $url = Url::fromRoute('user.login');
        $this->assertEquals(\Drupal::request()->getBaseUrl() . '/user/login?foo=bar', $url->toString());
    }

}

Classes

Title Deprecated Summary
UrlAlterTest Tests the capability to alter URLs.

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