You are here

public function RouterTest::testUrlGeneratorFront in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testUrlGeneratorFront()

Checks the generate method on the url generator using the front router.

File

core/modules/system/tests/src/Functional/Routing/RouterTest.php, line 236

Class

RouterTest
Functional class for the full integrated routing system.

Namespace

Drupal\Tests\system\Functional\Routing

Code

public function testUrlGeneratorFront() {
  $front_url = Url::fromRoute('<front>', [], [
    'absolute' => TRUE,
  ]);

  // Compare to the site base URL.
  $base_url = Url::fromUri('base:/', [
    'absolute' => TRUE,
  ]);
  $this
    ->assertSame($base_url
    ->toString(), $front_url
    ->toString());
}