You are here

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

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

File

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

Class

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

Namespace

Drupal\shortcut\Tests

Code

function testShortcutSetSwitchCreate() {
  $edit = array(
    'set' => 'new',
    'id' => strtolower($this
      ->randomMachineName()),
    'label' => $this
      ->randomString(),
  );
  $this
    ->drupalPostForm('user/' . $this->adminUser
    ->id() . '/shortcuts', $edit, t('Change set'));
  $current_set = shortcut_current_displayed_set($this->adminUser);
  $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.');
}