View source
<?php
namespace Drupal\Tests\user\Unit\Menu;
use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
class UserLocalTasksTest extends LocalTaskIntegrationTestBase {
protected function setUp() : void {
$this->directoryList = [
'user' => 'core/modules/user',
];
parent::setUp();
}
public function testUserAdminLocalTasks($route, $expected) {
$this
->assertLocalTasks($route, $expected);
}
public function getUserAdminRoutes() {
return [
[
'entity.user.collection',
[
[
'entity.user.collection',
'user.admin_permissions',
'entity.user_role.collection',
'user.role.settings',
],
],
],
[
'user.admin_permissions',
[
[
'entity.user.collection',
'user.admin_permissions',
'entity.user_role.collection',
'user.role.settings',
],
],
],
[
'entity.user_role.collection',
[
[
'entity.user.collection',
'user.admin_permissions',
'entity.user_role.collection',
'user.role.settings',
],
],
],
[
'entity.user.admin_form',
[
[
'user.account_settings_tab',
],
],
],
];
}
public function testUserLoginLocalTasks($route) {
$tasks = [
0 => [
'user.register',
'user.pass',
'user.login',
],
];
$this
->assertLocalTasks($route, $tasks);
}
public function getUserLoginRoutes() {
return [
[
'user.login',
],
[
'user.register',
],
[
'user.pass',
],
];
}
public function testUserPageLocalTasks($route, $subtask = []) {
$tasks = [
0 => [
'entity.user.canonical',
'entity.user.edit_form',
],
];
if ($subtask) {
$tasks[] = $subtask;
}
$this
->assertLocalTasks($route, $tasks);
}
public function getUserPageRoutes() {
return [
[
'entity.user.canonical',
],
[
'entity.user.edit_form',
],
];
}
}