function ShortcutSetsTest::testShortcutSetSwitchCreate

Tests switching a user's shortcut set and creating one at the same time.

File

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

Class

ShortcutSetsTest
Defines shortcut set test cases.

Namespace

Drupal\shortcut\Tests

Code

function testShortcutSetSwitchCreate() {
  $edit = array(
    'set' => 'new',
    'id' => strtolower($this
      ->randomName()),
    'label' => $this
      ->randomString(),
  );
  $this
    ->drupalPost('user/' . $this->admin_user->uid . '/shortcuts', $edit, t('Change set'));
  $current_set = shortcut_current_displayed_set($this->admin_user);
  $this
    ->assertNotEqual($current_set
    ->id(), $this->set
    ->id(), 'A shortcut set can be switched to at the same time as it is created.');
  $this
    ->assertEqual($current_set
    ->label(), $edit['label'], 'The new set is correctly assigned to the user.');
}