You are here

function ShortcutSetsTest::testShortcutSetUnassign in Zircon Profile 8

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

Tests unassigning a shortcut set.

File

core/modules/shortcut/src/Tests/ShortcutSetsTest.php, line 174
Contains \Drupal\shortcut\Tests\ShortcutSetsTest.

Class

ShortcutSetsTest
Create, view, edit, delete, and change shortcut sets.

Namespace

Drupal\shortcut\Tests

Code

function testShortcutSetUnassign() {
  $new_set = $this
    ->generateShortcutSet($this
    ->randomMachineName());
  $shortcut_set_storage = \Drupal::entityManager()
    ->getStorage('shortcut_set');
  $shortcut_set_storage
    ->assignUser($new_set, $this->shortcutUser);
  $shortcut_set_storage
    ->unassignUser($this->shortcutUser);
  $current_set = shortcut_current_displayed_set($this->shortcutUser);
  $default_set = shortcut_default_set($this->shortcutUser);
  $this
    ->assertTrue($current_set
    ->id() == $default_set
    ->id(), "Successfully unassigned another user's shortcut set.");
}