// Mock the view route names state.
$view_route_names =
[];
$view_route_names['example_view.page_1'
] = 'view.example_view.page_1';
$this->state->
expects($this->
exactly(2
)) ->
method('get'
) ->
with('views.view_route_names'
) ->
willReturn($view_route_names);
// Mock the route provider.
$route_collection =
new RouteCollection();
$route_collection->
add('test_route',
new Route('/path'
));
$this->routeProvider->
expects($this->
any()) ->
method('getRoutesByPattern'
) ->
with('/path'
) ->
willReturn($route_collection);
// Setup the existing local task of the test_route.
$definitions['test_route_tab'
] =
$other_tab =
[ 'route_name' => 'test_route',
'title' => 'Test route',
'base_route' => 'test_route',
];