You are here

public function PathValidatorTest::testGetUrlIfValidWithFrontPageAndQueryAndFragments in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testGetUrlIfValidWithFrontPageAndQueryAndFragments()

Tests the getUrlIfValid() method with a front page + query + fragments.

File

core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php, line 337
Contains \Drupal\Tests\Core\Path\PathValidatorTest.

Class

PathValidatorTest
@coversDefaultClass \Drupal\Core\Path\PathValidator @group Routing

Namespace

Drupal\Tests\Core\Path

Code

public function testGetUrlIfValidWithFrontPageAndQueryAndFragments() {
  $url = $this->pathValidator
    ->getUrlIfValid('<front>?hei=sen#berg');
  $this
    ->assertEquals('<front>', $url
    ->getRouteName());
  $this
    ->assertEquals([
    'hei' => 'sen',
  ], $url
    ->getOptions()['query']);
  $this
    ->assertEquals('berg', $url
    ->getOptions()['fragment']);
}