You are here

public function LocalTaskManagerTest::testGetLocalTaskForRouteWithFilledCache in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 211
Contains \Drupal\Tests\Core\Menu\LocalTaskManagerTest.

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetLocalTaskForRouteWithFilledCache() {
  $this->pluginDiscovery
    ->expects($this
    ->never())
    ->method('getDefinitions');
  $mock_plugin = $this
    ->getMock('Drupal\\Core\\Menu\\LocalTaskInterface');
  $this
    ->setupFactory($mock_plugin);
  $this
    ->setupLocalTaskManager();
  $result = $this
    ->getLocalTasksCache($mock_plugin);
  $this->cacheBackend
    ->expects($this
    ->at(0))
    ->method('get')
    ->with('local_task_plugins:en:menu_local_task_test_tasks_view')
    ->will($this
    ->returnValue((object) array(
    'data' => $result,
  )));
  $this->cacheBackend
    ->expects($this
    ->never())
    ->method('set');
  $result = $this
    ->getLocalTasksForRouteResult($mock_plugin);
  $local_tasks = $this->manager
    ->getLocalTasksForRoute('menu_local_task_test_tasks_view');
  $this
    ->assertEquals($result, $local_tasks);
}