
| Current Path : /var/www/html/german-vocational.cn/core/modules/user/tests/src/Unit/Menu/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/german-vocational.cn/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php |
<?php
namespace Drupal\Tests\user\Unit\Menu;
use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
/**
* Tests user local tasks.
*
* @group user
*/
class UserLocalTasksTest extends LocalTaskIntegrationTestBase {
protected function setUp() {
$this->directoryList = ['user' => 'core/modules/user'];
parent::setUp();
}
/**
* Tests local task existence.
*
* @dataProvider getUserAdminRoutes
*/
public function testUserAdminLocalTasks($route, $expected) {
$this->assertLocalTasks($route, $expected);
}
/**
* Provides a list of routes to test.
*/
public function getUserAdminRoutes() {
return [
['entity.user.collection', [['entity.user.collection', 'user.admin_permissions', 'entity.user_role.collection']]],
['user.admin_permissions', [['entity.user.collection', 'user.admin_permissions', 'entity.user_role.collection']]],
['entity.user_role.collection', [['entity.user.collection', 'user.admin_permissions', 'entity.user_role.collection']]],
['entity.user.admin_form', [['user.account_settings_tab']]],
];
}
/**
* Checks user listing local tasks.
*
* @dataProvider getUserLoginRoutes
*/
public function testUserLoginLocalTasks($route) {
$tasks = [
0 => ['user.register', 'user.pass', 'user.login'],
];
$this->assertLocalTasks($route, $tasks);
}
/**
* Provides a list of routes to test.
*/
public function getUserLoginRoutes() {
return [
['user.login'],
['user.register'],
['user.pass'],
];
}
/**
* Checks user listing local tasks.
*
* @dataProvider getUserPageRoutes
*/
public function testUserPageLocalTasks($route, $subtask = []) {
$tasks = [
0 => ['entity.user.canonical', 'entity.user.edit_form'],
];
if ($subtask) {
$tasks[] = $subtask;
}
$this->assertLocalTasks($route, $tasks);
}
/**
* Provides a list of routes to test.
*/
public function getUserPageRoutes() {
return [
['entity.user.canonical'],
['entity.user.edit_form'],
];
}
}