function PathValidatorTest::testGetUrlIfValidWithFrontPageAndQueryAndFragments

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

@legacy-covers ::getUrlIfValid

File

core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php, line 423

Class

PathValidatorTest
Tests Drupal\Core\Path\PathValidator.

Namespace

Drupal\Tests\Core\Path

Code

public function testGetUrlIfValidWithFrontPageAndQueryAndFragments() : void {
  $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']);
}

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