Commit 78f07605 authored by alexpott's avatar alexpott

Issue #2501355 by willzyx: Remove unused router.builder service from...

Issue #2501355 by willzyx: Remove unused router.builder service from Drupal\Core\Menu\LocalTaskManager
parent aa19ecfb
......@@ -498,7 +498,7 @@ services:
arguments: ['@controller_resolver', '@request_stack', '@current_route_match', '@router.route_provider', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
plugin.manager.menu.local_task:
class: Drupal\Core\Menu\LocalTaskManager
arguments: ['@controller_resolver', '@request_stack', '@current_route_match', '@router.route_provider', '@router.builder', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
arguments: ['@controller_resolver', '@request_stack', '@current_route_match', '@router.route_provider', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
plugin.manager.menu.contextual_link:
class: Drupal\Core\Menu\ContextualLinkManager
arguments: ['@controller_resolver', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user', '@request_stack']
......
......@@ -11,7 +11,6 @@
use Drupal\Core\Access\AccessManagerInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\NullBackend;
use Drupal\Core\Controller\ControllerResolverInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
......@@ -19,7 +18,6 @@
use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
use Drupal\Core\Plugin\Discovery\YamlDiscovery;
use Drupal\Core\Plugin\Factory\ContainerFactory;
use Drupal\Core\Routing\RouteBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\Session\AccountInterface;
......@@ -90,13 +88,6 @@ class LocalTaskManager extends DefaultPluginManager implements LocalTaskManagerI
*/
protected $routeProvider;
/**
* The route builder.
*
* @var \Drupal\Core\Routing\RouteBuilderInterface
*/
protected $routeBuilder;
/**
* The access manager.
*
......@@ -122,8 +113,6 @@ class LocalTaskManager extends DefaultPluginManager implements LocalTaskManagerI
* The current route match.
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
* The route provider to load routes by name.
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* The route builder.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
......@@ -135,7 +124,7 @@ class LocalTaskManager extends DefaultPluginManager implements LocalTaskManagerI
* @param \Drupal\Core\Session\AccountInterface $account
* The current user.
*/
public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteMatchInterface $route_match, RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteMatchInterface $route_match, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
$this->discovery = new YamlDiscovery('links.task', $module_handler->getModuleDirectories());
$this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
$this->factory = new ContainerFactory($this, '\Drupal\Core\Menu\LocalTaskInterface');
......@@ -143,7 +132,6 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re
$this->requestStack = $request_stack;
$this->routeMatch = $route_match;
$this->routeProvider = $route_provider;
$this->routeBuilder = $route_builder;
$this->accessManager = $access_manager;
$this->account = $account;
$this->moduleHandler = $module_handler;
......
......@@ -88,11 +88,6 @@ protected function getLocalTaskManager($module_dirs, $route_name, $route_params)
$property->setAccessible(TRUE);
$property->setValue($manager, $route_provider);
$route_builder = $this->getMock('Drupal\Core\Routing\RouteBuilderInterface');
$property = new \ReflectionProperty('Drupal\Core\Menu\LocalTaskManager', 'routeBuilder');
$property->setAccessible(TRUE);
$property->setValue($manager, $route_builder);
$module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandlerInterface')
->disableOriginalConstructor()
->getMock();
......
......@@ -49,13 +49,6 @@ class LocalTaskManagerTest extends UnitTestCase {
*/
protected $routeProvider;
/**
* The mocked route builder.
*
* @var \Drupal\Core\Routing\RouteBuilderInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $routeBuilder;
/**
* The mocked plugin discovery.
*
......@@ -100,7 +93,6 @@ protected function setUp() {
$this->controllerResolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface');
$this->request = new Request();
$this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
$this->routeBuilder = $this->getMock('Drupal\Core\Routing\RouteBuilderInterface');
$this->pluginDiscovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
$this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface');
$this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
......@@ -219,9 +211,6 @@ public function testGetLocalTaskForRouteWithFilledCache() {
$this->cacheBackend->expects($this->never())
->method('set');
$this->routeBuilder->expects($this->never())
->method('rebuild');
$result = $this->getLocalTasksForRouteResult($mock_plugin);
$local_tasks = $this->manager->getLocalTasksForRoute('menu_local_task_test_tasks_view');
$this->assertEquals($result, $local_tasks);
......@@ -261,7 +250,7 @@ protected function setupLocalTaskManager() {
->will($this->returnValue(new Language(array('id' => 'en'))));
$account = $this->getMock('Drupal\Core\Session\AccountInterface');
$this->manager = new LocalTaskManager($this->controllerResolver, $request_stack, $this->routeMatch, $this->routeProvider, $this->routeBuilder, $module_handler, $this->cacheBackend, $language_manager, $this->accessManager, $account);
$this->manager = new LocalTaskManager($this->controllerResolver, $request_stack, $this->routeMatch, $this->routeProvider, $module_handler, $this->cacheBackend, $language_manager, $this->accessManager, $account);
$property = new \ReflectionProperty('Drupal\Core\Menu\LocalTaskManager', 'discovery');
$property->setAccessible(TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment