function ShortcutSetsTest::testShortcutSetSwitchOwn
Tests switching a user's own shortcut set.
File
- 
              core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutSetsTest.php, line 107  
Class
- ShortcutSetsTest
 - Create, view, edit, delete, and change shortcut sets.
 
Namespace
Drupal\Tests\shortcut\FunctionalCode
public function testShortcutSetSwitchOwn() {
  $new_set = $this->generateShortcutSet($this->randomMachineName());
  // Attempt to switch the default shortcut set to the newly created shortcut
  // set.
  $this->drupalGet('user/' . $this->adminUser
    ->id() . '/shortcuts');
  $this->submitForm([
    'set' => $new_set->id(),
  ], 'Change set');
  $this->assertSession()
    ->statusCodeEquals(200);
  $current_set = shortcut_current_displayed_set($this->adminUser);
  $this->assertSame($current_set->id(), $new_set->id(), 'Successfully switched own shortcut set.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.