function ShortcutSetsTest::testShortcutSetSwitchCreate
Same name in other branches
- 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetSwitchCreate()
- 10 core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetSwitchCreate()
- 11.x 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.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.