public function ShortcutLinksTest::testShortcutLinkRename in Drupal 8
Same name and namespace in other branches
- 9 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkRename()
- 10 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkRename()
Tests that shortcut links can be renamed.
File
- core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutLinksTest.php, line 231
Class
- ShortcutLinksTest
- Create, view, edit, delete, and change shortcut links.
Namespace
Drupal\Tests\shortcut\FunctionalCode
public function testShortcutLinkRename() {
$set = $this->set;
// Attempt to rename shortcut link.
$new_link_name = $this
->randomMachineName();
$shortcuts = $set
->getShortcuts();
$shortcut = reset($shortcuts);
$this
->drupalPostForm('admin/config/user-interface/shortcut/link/' . $shortcut
->id(), [
'title[0][value]' => $new_link_name,
], t('Save'));
$saved_set = ShortcutSet::load($set
->id());
$titles = $this
->getShortcutInformation($saved_set, 'title');
$this
->assertContains($new_link_name, $titles, 'Shortcut renamed: ' . $new_link_name);
$this
->assertSession()
->linkExists($new_link_name, 0, 'Renamed shortcut link appears on the page.');
$this
->assertText(t('The shortcut @link has been updated.', [
'@link' => $new_link_name,
]));
}