function LocalTaskManagerTest::getLocalTasksCache

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

Returns the cache entry expected when running getLocalTaskForRoute().

Return value

array

2 calls to LocalTaskManagerTest::getLocalTasksCache()
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.

File

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

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

protected function getLocalTasksCache() {
    $local_task_fixtures = $this->getLocalTaskFixtures();
    $local_tasks = [
        'base_routes' => [
            'menu_local_task_test_tasks_view' => 'menu_local_task_test_tasks_view',
        ],
        'parents' => [
            'menu_local_task_test_tasks_view.tab' => TRUE,
        ],
        'children' => [
            '> menu_local_task_test_tasks_view' => [
                'menu_local_task_test_tasks_settings' => $local_task_fixtures['menu_local_task_test_tasks_settings'],
                'menu_local_task_test_tasks_edit' => $local_task_fixtures['menu_local_task_test_tasks_edit'],
                'menu_local_task_test_tasks_view.tab' => $local_task_fixtures['menu_local_task_test_tasks_view.tab'],
            ],
            'menu_local_task_test_tasks_view.tab' => [
                // The manager will fill in the base_route before caching.
'menu_local_task_test_tasks_view_child1' => [
                    'base_route' => 'menu_local_task_test_tasks_view',
                ] + $local_task_fixtures['menu_local_task_test_tasks_view_child1'],
                'menu_local_task_test_tasks_view_child2' => [
                    'base_route' => 'menu_local_task_test_tasks_view',
                ] + $local_task_fixtures['menu_local_task_test_tasks_view_child2'],
            ],
        ],
    ];
    $local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_settings']['weight'] = 0;
    $local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_edit']['weight'] = 20 + 1.0E-6;
    $local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_view.tab']['weight'] = 2.0E-6;
    $local_tasks['children']['menu_local_task_test_tasks_view.tab']['menu_local_task_test_tasks_view_child1']['weight'] = 3.0E-6;
    $local_tasks['children']['menu_local_task_test_tasks_view.tab']['menu_local_task_test_tasks_view_child2']['weight'] = 4.0E-6;
    return $local_tasks;
}

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