/**
* Tests deprecation of toRenderArray() method.
*
* @covers ::toRenderArray
* @group legacy
*/
public function testToRenderArray() { $this->
expectDeprecation('Drupal\Core\Url::toRenderArray() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3342977'
);
$url = Url::
fromRoute('entity.node.canonical',
['node' => 3
]);
$this->
assertIsArray($url->
toRenderArray());
} /**
* Tests the fromRouteMatch() method.
*/
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());
}