ShortcutLocalTasksTest.php

Same filename and directory in other branches
  1. 11.x core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php
  2. 10 core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php
  3. 9 core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php

Namespace

Drupal\Tests\shortcut\Unit\Menu

File

core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php

View source
<?php

namespace Drupal\Tests\shortcut\Unit\Menu;

use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;

/**
 * Tests existence of shortcut local tasks.
 *
 * @group shortcut
 */
class ShortcutLocalTasksTest extends LocalTaskIntegrationTestBase {
  protected function setUp() {
    $this->directoryList = [
      'shortcut' => 'core/modules/shortcut',
      'user' => 'core/modules/user',
    ];
    parent::setUp();
  }
  
  /**
   * Checks shortcut listing local tasks.
   *
   * @dataProvider getShortcutPageRoutes
   */
  public function testShortcutPageLocalTasks($route) {
    $tasks = [
      0 => [
        'shortcut.set_switch',
        'entity.user.canonical',
        'entity.user.edit_form',
      ],
    ];
    $this->assertLocalTasks($route, $tasks);
  }
  
  /**
   * Provides a list of routes to test.
   */
  public function getShortcutPageRoutes() {
    return [
      [
        'entity.user.canonical',
      ],
      [
        'entity.user.edit_form',
      ],
      [
        'shortcut.set_switch',
      ],
    ];
  }

}

Classes

Title Deprecated Summary
ShortcutLocalTasksTest Tests existence of shortcut local tasks.

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