function ShortcutSetsTest::testShortcutSetAssign

Same name in other branches
  1. 9 core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetAssign()
  2. 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetAssign()
  3. 10 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 123

Class

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

Namespace

Drupal\Tests\shortcut\Functional

Code

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

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