public function UrlTest::testFromRouteMatch in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 510 
- 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());
}