setupMocks example

->method('getStorage')
      ->with('view')
      ->willReturn($this->viewStorage);
    $this->state = $this->createMock('\Drupal\Core\State\StateInterface');
    $this->routeSubscriber = new TestRouteSubscriber($this->entityTypeManager, $this->state);
  }

  /** * @covers ::routeRebuildFinished */
  public function testRouteRebuildFinished() {
    [$display_1$display_2] = $this->setupMocks();

    $display_1->expects($this->once())
      ->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())
      
Home | Imprint | This part of the site doesn't use cookies.