You are here

public function ShortcutSetsTest::testShortcutSetUnassign in Drupal 8

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

Tests unassigning a shortcut set.

File

core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php, line 174

Class

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

Namespace

Drupal\Tests\shortcut\Functional

Code

public function testShortcutSetUnassign() {
  $new_set = $this
    ->generateShortcutSet($this
    ->randomMachineName());
  $shortcut_set_storage = \Drupal::entityTypeManager()
    ->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.");
}