function ShortcutLinksTest::verifyAccessShortcutsPermissionForEditPages

Same name in other branches
  1. 9 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::verifyAccessShortcutsPermissionForEditPages()
  2. 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::verifyAccessShortcutsPermissionForEditPages()
  3. 11.x core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::verifyAccessShortcutsPermissionForEditPages()

Tests the 'access shortcuts' permission for shortcut set administration.

1 call to ShortcutLinksTest::verifyAccessShortcutsPermissionForEditPages()
ShortcutLinksTest::testAccessShortcutsPermission in core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php
Tests that the 'access shortcuts' permissions works properly.

File

core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php, line 432

Class

ShortcutLinksTest
Create, view, edit, delete, and change shortcut links.

Namespace

Drupal\Tests\shortcut\Functional

Code

private function verifyAccessShortcutsPermissionForEditPages() {
    // Create a user with customize links and switch sets permissions  but
    // without the 'access shortcuts' permission.
    $test_permissions = [
        'customize shortcut links',
        'switch shortcut sets',
    ];
    $no_access_user = $this->drupalCreateUser($test_permissions);
    $this->drupalLogin($no_access_user);
    // Verify that set administration pages are inaccessible without the
    // 'access shortcuts' permission.
    $this->drupalGet('admin/config/user-interface/shortcut/manage/default/customize');
    $this->assertSession()
        ->statusCodeEquals(403);
    $this->drupalGet('admin/config/user-interface/shortcut/manage/default');
    $this->assertSession()
        ->statusCodeEquals(403);
    $this->drupalGet('user/' . $no_access_user->id() . '/shortcuts');
    $this->assertSession()
        ->statusCodeEquals(403);
}

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