routeRebuildFinished example

->method('collectRoutes')
      ->willReturn(['test_id.page_1' => 'views.test_id.page_1']);
    $display_2->expects($this->once())
      ->method('collectRoutes')
      ->willReturn(['test_id.page_2' => 'views.test_id.page_2']);

    $this->routeSubscriber->routes();

    $this->state->expects($this->once())
      ->method('set')
      ->with('views.view_route_names', ['test_id.page_1' => 'views.test_id.page_1', 'test_id.page_2' => 'views.test_id.page_2']);
    $this->routeSubscriber->routeRebuildFinished();
  }

  /** * Tests the onAlterRoutes method. * * @see \Drupal\views\EventSubscriber\RouteSubscriber::onAlterRoutes() */
  public function testOnAlterRoutes() {
    $collection = new RouteCollection();
    // The first route will be overridden later.     $collection->add('test_route', new Route('test_route', ['_controller' => 'Drupal\Tests\Core\Controller\TestController']));
    
Home | Imprint | This part of the site doesn't use cookies.