diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php index c4dd3d8..8ac918d 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php @@ -113,7 +113,14 @@ public function testGetLocalTasksForRouteSingleLevelTitle() { $this->setupLocalTaskManager(); $local_tasks = $this->manager->getLocalTasksForRoute('menu_local_task_test_tasks_view'); - $result = $this->getLocalTasksForRouteResult($mock_plugin); + + $result = array( + 0 => array( + 'menu_local_task_test_tasks_settings' => $mock_plugin, + 'menu_local_task_test_tasks_view' => $mock_plugin, + 'menu_local_task_test_tasks_edit' => $mock_plugin, + ) + ); $this->assertEquals($result, $local_tasks); } @@ -147,9 +154,11 @@ public function testGetLocalTaskForRouteWithEmptyCache() { ->method('set') ->with('local_task:en', $definitions, CacheBackendInterface::CACHE_PERMANENT); + $expected_set = $this->getLocalTasksCache(); + $this->cacheBackend->expects($this->at(3)) ->method('set') - ->with('local_task:en:menu_local_task_test_tasks_view', $result, CacheBackendInterface::CACHE_PERMANENT, array('local_task')); + ->with('local_task:en:menu_local_task_test_tasks_view', $expected_set, CacheBackendInterface::CACHE_PERMANENT, array('local_task')); $local_tasks = $this->manager->getLocalTasksForRoute('menu_local_task_test_tasks_view'); $this->assertEquals($result, $local_tasks); @@ -167,7 +176,7 @@ public function testGetLocalTaskForRouteWithFilledCache() { $this->setupLocalTaskManager(); - $result = $this->getLocalTasksForRouteResult($mock_plugin); + $result = $this->getLocalTasksCache($mock_plugin); $this->cacheBackend->expects($this->at(0)) ->method('get') @@ -177,6 +186,7 @@ public function testGetLocalTaskForRouteWithFilledCache() { $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); } @@ -323,5 +333,24 @@ protected function getLocalTasksForRouteResult($mock_plugin) { return $result; } + /** + * Returns the cache entry expected when running getLocalTaskForRoute(). + * + * @return array + */ + protected function getLocalTasksCache() { + return array( + 'tab_root_ids' => array( + 'menu_local_task_test_tasks_view' => 'menu_local_task_test_tasks_view', + ), + 'parents' => array( + 'menu_local_task_test_tasks_view' => 1, + ), + 'children' => array( + '> menu_local_task_test_tasks_view' => $this->getLocalTaskFixtures(), + ) + ); + } + }