3 namespace Drupal\Tests\user\Unit\Menu;
5 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
8 * Tests user local tasks.
12 class UserLocalTasksTest extends LocalTaskIntegrationTestBase {
14 protected function setUp() {
15 $this->directoryList = ['user' => 'core/modules/user'];
20 * Tests local task existence.
22 * @dataProvider getUserAdminRoutes
24 public function testUserAdminLocalTasks($route, $expected) {
25 $this->assertLocalTasks($route, $expected);
29 * Provides a list of routes to test.
31 public function getUserAdminRoutes() {
33 ['entity.user.collection', [['entity.user.collection', 'user.admin_permissions', 'entity.user_role.collection']]],
34 ['user.admin_permissions', [['entity.user.collection', 'user.admin_permissions', 'entity.user_role.collection']]],
35 ['entity.user_role.collection', [['entity.user.collection', 'user.admin_permissions', 'entity.user_role.collection']]],
36 ['entity.user.admin_form', [['user.account_settings_tab']]],
41 * Checks user listing local tasks.
43 * @dataProvider getUserLoginRoutes
45 public function testUserLoginLocalTasks($route) {
47 0 => ['user.register', 'user.pass', 'user.login'],
49 $this->assertLocalTasks($route, $tasks);
53 * Provides a list of routes to test.
55 public function getUserLoginRoutes() {
64 * Checks user listing local tasks.
66 * @dataProvider getUserPageRoutes
68 public function testUserPageLocalTasks($route, $subtask = []) {
70 0 => ['entity.user.canonical', 'entity.user.edit_form'],
72 if ($subtask) $tasks[] = $subtask;
73 $this->assertLocalTasks($route, $tasks);
77 * Provides a list of routes to test.
79 public function getUserPageRoutes() {
81 ['entity.user.canonical'],
82 ['entity.user.edit_form'],