function LocalTaskManagerTest::testGetLocalTaskForRouteWithFilledCache

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php \Drupal\Tests\Core\Menu\LocalTaskManagerTest::testGetLocalTaskForRouteWithFilledCache()
  2. 8.9.x core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php \Drupal\Tests\Core\Menu\LocalTaskManagerTest::testGetLocalTaskForRouteWithFilledCache()
  3. 11.x core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php \Drupal\Tests\Core\Menu\LocalTaskManagerTest::testGetLocalTaskForRouteWithFilledCache()

Tests the cache of the local task manager with a filled initial cache.

File

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

Class

LocalTaskManagerTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskManager[[api-linebreak]] @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetLocalTaskForRouteWithFilledCache() : void {
  $this->pluginDiscovery
    ->expects($this->never())
    ->method('getDefinitions');
  $mock_plugin = $this->createMock('Drupal\\Core\\Menu\\LocalTaskInterface');
  $this->setupFactory($mock_plugin);
  $this->setupLocalTaskManager();
  $result = $this->getLocalTasksCache();
  $this->cacheBackend
    ->get('local_task_plugins:en:menu_local_task_test_tasks_view')
    ->willReturn((object) [
    'data' => $result,
  ]);
  $this->cacheBackend
    ->set()
    ->shouldNotBeCalled();
  $result = $this->getLocalTasksForRouteResult($mock_plugin);
  $local_tasks = $this->manager
    ->getLocalTasksForRoute('menu_local_task_test_tasks_view');
  $this->assertEquals($result, $local_tasks);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.