You are here

protected function LocalTaskManagerTest::setupLocalTaskManager in Drupal 8

Setups the local task manager for the test.

6 calls to LocalTaskManagerTest::setupLocalTaskManager()
LocalTaskManagerTest::setUp in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
LocalTaskManagerTest::testGetLocalTaskForRouteWithEmptyCache in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Tests the cache of the local task manager with an empty initial cache.
LocalTaskManagerTest::testGetLocalTaskForRouteWithFilledCache in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Tests the cache of the local task manager with a filled initial cache.
LocalTaskManagerTest::testGetLocalTasksForRouteForChild in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Tests the getLocalTasksForRoute method on a child.
LocalTaskManagerTest::testGetLocalTasksForRouteSingleLevelTitle in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Tests the getLocalTasksForRoute method.

... See full list

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php, line 276

Class

LocalTaskManagerTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskManager @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

protected function setupLocalTaskManager() {
  $request_stack = new RequestStack();
  $request_stack
    ->push($this->request);
  $module_handler = $this
    ->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
  $module_handler
    ->expects($this
    ->any())
    ->method('getModuleDirectories')
    ->willReturn([]);
  $language_manager = $this
    ->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
  $language_manager
    ->expects($this
    ->any())
    ->method('getCurrentLanguage')
    ->will($this
    ->returnValue(new Language([
    'id' => 'en',
  ])));
  $this->manager = new LocalTaskManager($this->argumentResolver, $request_stack, $this->routeMatch, $this->routeProvider, $module_handler, $this->cacheBackend, $language_manager, $this->accessManager, $this->account);
  $property = new \ReflectionProperty('Drupal\\Core\\Menu\\LocalTaskManager', 'discovery');
  $property
    ->setAccessible(TRUE);
  $property
    ->setValue($this->manager, $this->pluginDiscovery);
  $property = new \ReflectionProperty('Drupal\\Core\\Menu\\LocalTaskManager', 'factory');
  $property
    ->setAccessible(TRUE);
  $property
    ->setValue($this->manager, $this->factory);
}