You are here

public function RouterTest::testUrlGeneratorFront in Drupal 8

Same name and namespace in other branches
  1. 9 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 227

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
    ->assertIdentical($base_url
    ->toString(), $front_url
    ->toString());
}