You are here

public function RouterBaseTest::testFinalize in Drupal 7 to 8/9 Module Upgrader 8

@depends testAddRoute

File

tests/src/Unit/Routing/RouterBaseTest.php, line 47

Class

RouterBaseTest
@group DMU.Routing

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit\Routing

Code

public function testFinalize() {
  $router = new RouterBase();
  $user_edit = new RouteWrapper('user.edit', $this->userEdit, $this->routeProvider);
  $router
    ->addRoute($user_edit);
  $user_view = new RouteWrapper('user.view', $this->userView, $this->routeProvider);
  $router
    ->addRoute($user_view);
  $router
    ->finalize();
  $this
    ->assertTrue($user_edit
    ->hasParent());
  $this
    ->assertSame($user_view, $user_edit
    ->getParent());
  $this
    ->assertTrue($user_view
    ->hasParent());
  $this
    ->assertEquals('/user', $user_view
    ->getParent()
    ->getPath());
}