function UrlTest::testFromRouteMatch
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::testFromRouteMatch()
- 10 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::testFromRouteMatch()
- 11.x core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::testFromRouteMatch()
Tests the fromRouteMatch() method.
File
-
core/
tests/ Drupal/ Tests/ Core/ UrlTest.php, line 545
Class
- UrlTest
- @coversDefaultClass \Drupal\Core\Url @group UrlTest
Namespace
Drupal\Tests\CoreCode
public function testFromRouteMatch() {
$route = new Route('/test-route/{foo}');
$route_match = new RouteMatch('test_route', $route, [
'foo' => (object) [
1,
],
], [
'foo' => 1,
]);
$url = Url::fromRouteMatch($route_match);
$this->assertSame('test_route', $url->getRouteName());
$this->assertEquals([
'foo' => '1',
], $url->getRouteParameters());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.