function ShortcutSetsTest::testShortcutSetSwitchOwn

Tests switching a user's own shortcut set.

File

drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php, line 39
Definition of Drupal\shortcut\Tests\ShortcutSetsTest.

Class

ShortcutSetsTest
Defines shortcut set test cases.

Namespace

Drupal\shortcut\Tests

Code

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

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