->
method('findAll'
) ->
willReturn([ 'test_module' =>
[ 'route_callbacks' =>
[ '\Drupal\Tests\Core\Routing\TestRouteSubscriber::routesFromArray',
'test_module.route_service:routesFromCollection',
],
],
]);
$container =
new ContainerBuilder();
$container->
set('test_module.route_service',
new TestRouteSubscriber());
$this->controllerResolver->
expects($this->
any()) ->
method('getControllerFromDefinition'
) ->
willReturnCallback(function D
$controller) use ($container) { $count =
substr_count($controller, ':'
);
if ($count == 1
) { [$service,
$method] =
explode(':',
$controller, 2
);
$object =
$container->
get($service);
} else { [$class,
$method] =
explode('::',
$controller, 2
);
$object =
new $class();
}