You are here

function ShortcutSetsTest::testShortcutSetSwitchOwn 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::testShortcutSetSwitchOwn()

Tests switching a user's own shortcut set.

File

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

Class

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

Namespace

Drupal\shortcut\Tests

Code

function testShortcutSetSwitchOwn() {
  $new_set = $this
    ->generateShortcutSet($this
    ->randomMachineName());

  // Attempt to switch the default shortcut set to the newly created shortcut
  // set.
  $this
    ->drupalPostForm('user/' . $this->adminUser
    ->id() . '/shortcuts', array(
    'set' => $new_set
      ->id(),
  ), t('Change set'));
  $this
    ->assertResponse(200);
  $current_set = shortcut_current_displayed_set($this->adminUser);
  $this
    ->assertTrue($new_set
    ->id() == $current_set
    ->id(), 'Successfully switched own shortcut set.');
}