You are here

public function ShortcutLinksTest::testShortcutBlockAccess 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::testShortcutBlockAccess()

Tests that the 'access shortcuts' permission is required to access the shortcut block.

File

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

Class

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

Namespace

Drupal\shortcut\Tests

Code

public function testShortcutBlockAccess() {

  // 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(array()));
  $this
    ->drupalGet('');
  $this
    ->assertNoBlockAppears($block);
}