public function LocalTaskManagerTest::testGetLocalTaskForRouteWithEmptyCache in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php \Drupal\Tests\Core\Menu\LocalTaskManagerTest::testGetLocalTaskForRouteWithEmptyCache()
Tests the cache of the local task manager with an empty initial cache.
File
- core/
tests/ Drupal/ Tests/ Core/ Menu/ LocalTaskManagerTest.php, line 172 - Contains \Drupal\Tests\Core\Menu\LocalTaskManagerTest.
Class
- LocalTaskManagerTest
- @coversDefaultClass \Drupal\Core\Menu\LocalTaskManager @group Menu
Namespace
Drupal\Tests\Core\MenuCode
public function testGetLocalTaskForRouteWithEmptyCache() {
$definitions = $this
->getLocalTaskFixtures();
$this->pluginDiscovery
->expects($this
->once())
->method('getDefinitions')
->will($this
->returnValue($definitions));
$mock_plugin = $this
->getMock('Drupal\\Core\\Menu\\LocalTaskInterface');
$this
->setupFactory($mock_plugin);
$this
->setupLocalTaskManager();
$result = $this
->getLocalTasksForRouteResult($mock_plugin);
$this->cacheBackend
->expects($this
->at(0))
->method('get')
->with('local_task_plugins:en:menu_local_task_test_tasks_view');
$this->cacheBackend
->expects($this
->at(1))
->method('get')
->with('local_task_plugins:en');
$this->cacheBackend
->expects($this
->at(2))
->method('set')
->with('local_task_plugins:en', $definitions, Cache::PERMANENT);
$expected_set = $this
->getLocalTasksCache();
$this->cacheBackend
->expects($this
->at(3))
->method('set')
->with('local_task_plugins:en:menu_local_task_test_tasks_view', $expected_set, Cache::PERMANENT, array(
'local_task',
));
$local_tasks = $this->manager
->getLocalTasksForRoute('menu_local_task_test_tasks_view');
$this
->assertEquals($result, $local_tasks);
}