You are here

public function ShortcutSetsTest::testShortcutSetAssign in Drupal 10

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

Tests switching another user's shortcut set.

File

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

Class

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

Namespace

Drupal\Tests\shortcut\Functional

Code

public function testShortcutSetAssign() {
  $new_set = $this
    ->generateShortcutSet($this
    ->randomMachineName());
  \Drupal::entityTypeManager()
    ->getStorage('shortcut_set')
    ->assignUser($new_set, $this->shortcutUser);
  $current_set = shortcut_current_displayed_set($this->shortcutUser);
  $this
    ->assertSame($current_set
    ->id(), $new_set
    ->id(), "Successfully switched another user's shortcut set.");
}