You are here

private function ShortcutLinksTest::verifyAccessShortcutsPermissionForEditPages in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/shortcut/src/Tests/ShortcutLinksTest.php \Drupal\shortcut\Tests\ShortcutLinksTest::verifyAccessShortcutsPermissionForEditPages()

Tests that the 'access shortcuts' permission is required for shortcut set administration page access.

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

File

core/modules/shortcut/src/Tests/ShortcutLinksTest.php, line 363
Contains \Drupal\shortcut\Tests\ShortcutLinksTest.

Class

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

Namespace

Drupal\shortcut\Tests

Code

private function verifyAccessShortcutsPermissionForEditPages() {

  // Create a user with customize links and switch sets permissions  but
  // without the 'access shortcuts' permission.
  $test_permissions = array(
    'customize shortcut links',
    'switch shortcut sets',
  );
  $noaccess_user = $this
    ->drupalCreateUser($test_permissions);
  $this
    ->drupalLogin($noaccess_user);

  // Verify that set administration pages are inaccessible without the
  // 'access shortcuts' permission.
  $edit_paths = array(
    'admin/config/user-interface/shortcut/manage/default/customize',
    'admin/config/user-interface/shortcut/manage/default',
    'user/' . $noaccess_user
      ->id() . '/shortcuts',
  );
  foreach ($edit_paths as $path) {
    $this
      ->drupalGet($path);
    $message = format_string('Access is denied on %s', array(
      '%s' => $path,
    ));
    $this
      ->assertResponse(403, $message);
  }
}