function LocalTaskManagerTest::getLocalTaskFixtures

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

Return some local tasks plugin definitions.

Return value

array An array of plugin definition keyed by plugin ID.

6 calls to LocalTaskManagerTest::getLocalTaskFixtures()
LocalTaskManagerTest::getLocalTasksCache in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Returns the cache entry expected when running getLocalTaskForRoute().
LocalTaskManagerTest::setupFactory in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Setups the plugin factory with some local task plugins.
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::testGetLocalTasksForRouteForChild in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Tests the getLocalTasksForRoute method on a child.
LocalTaskManagerTest::testGetLocalTasksForRouteSingleLevelTitle in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
Tests the getLocalTasksForRoute method.

... See full list

File

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

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

protected function getLocalTaskFixtures() {
    $definitions = [];
    $definitions['menu_local_task_test_tasks_settings'] = [
        'route_name' => 'menu_local_task_test_tasks_settings',
        'title' => 'Settings',
        'base_route' => 'menu_local_task_test_tasks_view',
    ];
    $definitions['menu_local_task_test_tasks_edit'] = [
        'route_name' => 'menu_local_task_test_tasks_edit',
        'title' => 'Settings',
        'base_route' => 'menu_local_task_test_tasks_view',
        'weight' => 20,
    ];
    // Make this ID different from the route name to catch code that
    // confuses them.
    $definitions['menu_local_task_test_tasks_view.tab'] = [
        'route_name' => 'menu_local_task_test_tasks_view',
        'title' => 'Settings',
        'base_route' => 'menu_local_task_test_tasks_view',
    ];
    $definitions['menu_local_task_test_tasks_view_child1'] = [
        'route_name' => 'menu_local_task_test_tasks_child1_page',
        'title' => 'Settings child #1',
        'parent_id' => 'menu_local_task_test_tasks_view.tab',
    ];
    $definitions['menu_local_task_test_tasks_view_child2'] = [
        'route_name' => 'menu_local_task_test_tasks_child2_page',
        'title' => 'Settings child #2',
        'parent_id' => 'menu_local_task_test_tasks_view.tab',
        'base_route' => 'this_should_be_replaced',
    ];
    // Add the ID and defaults from the LocalTaskManager.
    foreach ($definitions as $id => &$info) {
        $info['id'] = $id;
        $info += [
            'id' => '',
            'route_name' => '',
            'route_parameters' => [],
            'title' => '',
            'base_route' => '',
            'parent_id' => NULL,
            'weight' => 0,
            'options' => [],
            'class' => 'Drupal\\Core\\Menu\\LocalTaskDefault',
        ];
    }
    return $definitions;
}

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