public function ShortcutSetsTest::testShortcutSetSwitchCreate in Drupal 9
Same name and namespace in other branches
- 8 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
->drupalGet('user/' . $this->adminUser
->id() . '/shortcuts');
$this
->submitForm($edit, 'Change set');
$current_set = shortcut_current_displayed_set($this->adminUser);
$this
->assertNotEquals($this->set
->id(), $current_set
->id(), 'A shortcut set can be switched to at the same time as it is created.');
$this
->assertEquals($edit['label'], $current_set
->label(), 'The new set is correctly assigned to the user.');
}