function UrlTest::testSetRouteParameterWithUnroutedUrl

Tests the setRouteParameter() with an unrouted URL.

@legacy-covers ::setRouteParameter

File

core/tests/Drupal/Tests/Core/UrlTest.php, line 426

Class

UrlTest
Tests Drupal\Core\Url.

Namespace

Drupal\Tests\Core

Code

public function testSetRouteParameterWithUnroutedUrl() : void {
  $url = Url::fromUri('https://example.com');
  $this->expectException(\UnexpectedValueException::class);
  $this->expectExceptionMessage('https://example.com has no corresponding route.');
  $url->setRouteParameter('foo', 'bar');
}

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