public function UrlTest::testFromRouteMatch in Drupal 8
Tests the fromRouteMatch() method.
File
- core/
tests/ Drupal/ Tests/ Core/ UrlTest.php, line 545 - Contains \Drupal\Tests\Core\UrlTest.
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());
}