function ShortcutLinksTest::testShortcutBlockAccess

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

Tests the 'access shortcuts' permission with the shortcut block.

File

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

Class

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

Namespace

Drupal\Tests\shortcut\Functional

Code

public function testShortcutBlockAccess() : void {
  // Creates a block instance and place in a region through api.
  $block = $this->drupalPlaceBlock('shortcuts');
  // Verify that users with the 'access shortcuts' permission can see the
  // shortcut block.
  $this->drupalLogin($this->shortcutUser);
  $this->drupalGet('');
  $this->assertBlockAppears($block);
  $this->drupalLogout();
  // Verify that users without the 'access shortcuts' permission can see the
  // shortcut block.
  $this->drupalLogin($this->drupalCreateUser([]));
  $this->drupalGet('');
  $this->assertNoBlockAppears($block);
}

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