You are here

protected function WorkbenchPreprocessTest::setupCurrentRouteMatch in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/WorkbenchPreprocessTest.php \Drupal\Tests\workbench_moderation\Unit\WorkbenchPreprocessTest::setupCurrentRouteMatch()

Mock the current route matching object.

Parameters

string $routeName: Route.

int $nid: Node id.

Return value

\Drupal\Core\Routing\CurrentRouteMatch Returns cuurent route.

1 call to WorkbenchPreprocessTest::setupCurrentRouteMatch()
WorkbenchPreprocessTest::testIsLatestVersionPage in tests/src/Unit/WorkbenchPreprocessTest.php
@covers ::isLatestVersionPage @dataProvider routeNodeProvider

File

tests/src/Unit/WorkbenchPreprocessTest.php, line 56

Class

WorkbenchPreprocessTest
Class WorkbenchPreprocessTest.

Namespace

Drupal\Tests\workbench_moderation\Unit

Code

protected function setupCurrentRouteMatch($routeName, $nid) {
  $route_match = $this
    ->prophesize(CurrentRouteMatch::class);
  $route_match
    ->getRouteName()
    ->willReturn($routeName);
  $route_match
    ->getParameter('node')
    ->willReturn($this
    ->setupNode($nid));
  return $route_match
    ->reveal();
}