You are here

protected function WorkbenchPreprocessTest::setupCurrentRouteMatch in Workbench Moderation 8.2

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

Mock the current route matching object.

Parameters

string $route:

int $nid:

Return value

CurrentRouteMatch

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

File

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

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();
}