public function ShortcutSetsTest::testShortcutSetSwitchCreate in Drupal 8
Same name and namespace in other branches
- 9 core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetSwitchCreate()
Tests switching a user's shortcut set and creating one at the same time.
File
- core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutSetsTest.php, line 133
Class
- ShortcutSetsTest
- Create, view, edit, delete, and change shortcut sets.
Namespace
Drupal\Tests\shortcut\FunctionalCode
public function testShortcutSetSwitchCreate() {
$edit = [
'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.');
}