class ShortcutLocalTasksTest
Same name and namespace in other branches
- 11.x core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php \Drupal\Tests\shortcut\Unit\Menu\ShortcutLocalTasksTest
Tests existence of shortcut local tasks.
@group shortcut
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase implements \Drupal\Tests\UnitTestCase
- class \Drupal\Tests\shortcut\Unit\Menu\ShortcutLocalTasksTest implements \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase
- class \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase implements \Drupal\Tests\UnitTestCase
Expanded class hierarchy of ShortcutLocalTasksTest
File
-
core/
modules/ shortcut/ tests/ src/ Unit/ Menu/ ShortcutLocalTasksTest.php, line 13
Namespace
Drupal\Tests\shortcut\Unit\MenuView source
class ShortcutLocalTasksTest extends LocalTaskIntegrationTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
$this->directoryList = [
'shortcut' => 'core/modules/shortcut',
'user' => 'core/modules/user',
];
parent::setUp();
// Add services required for user local tasks.
$entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
$entity_type_manager->expects($this->any())
->method('getDefinitions')
->willReturn([]);
$this->container
->set('entity_type.manager', $entity_type_manager);
$this->container
->set('string_translation', $this->getStringTranslationStub());
}
/**
* 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',
],
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.