You are here

public function RouteSubscriberTest::testRouteRebuildFinished in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php \Drupal\Tests\views\Unit\EventSubscriber\RouteSubscriberTest::testRouteRebuildFinished()

@covers ::routeRebuildFinished

File

core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php, line 67
Contains \Drupal\Tests\views\Unit\EventSubscriber\RouteSubscriberTest.

Class

RouteSubscriberTest
@coversDefaultClass \Drupal\views\EventSubscriber\RouteSubscriber @group views

Namespace

Drupal\Tests\views\Unit\EventSubscriber

Code

public function testRouteRebuildFinished() {
  list($display_1, $display_2) = $this
    ->setupMocks();
  $display_1
    ->expects($this
    ->once())
    ->method('collectRoutes')
    ->will($this
    ->returnValue([
    'test_id.page_1' => 'views.test_id.page_1',
  ]));
  $display_2
    ->expects($this
    ->once())
    ->method('collectRoutes')
    ->will($this
    ->returnValue([
    '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();
}