function ShortcutLinksTest::testShortcutLinkChangePath
Same name in other branches
- 9 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkChangePath()
- 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkChangePath()
- 10 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkChangePath()
Tests that changing the path of a shortcut link works.
File
-
core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutLinksTest.php, line 275
Class
- ShortcutLinksTest
- Create, view, edit, delete, and change shortcut links.
Namespace
Drupal\Tests\shortcut\FunctionalCode
public function testShortcutLinkChangePath() : void {
$set = $this->set;
// Tests changing a shortcut path.
$new_link_path = '/admin/config';
$shortcuts = $set->getShortcuts();
$shortcut = reset($shortcuts);
$this->drupalGet('admin/config/user-interface/shortcut/link/' . $shortcut->id());
$this->submitForm([
'title[0][value]' => $shortcut->getTitle(),
'link[0][uri]' => $new_link_path,
], 'Save');
$saved_set = ShortcutSet::load($set->id());
$paths = $this->getShortcutInformation($saved_set, 'link');
$this->assertContains('internal:' . $new_link_path, $paths, 'Shortcut path changed: ' . $new_link_path);
$this->assertSession()
->linkByHrefExists($new_link_path, 0, 'Shortcut with new path appears on the page.');
$this->assertSession()
->pageTextContains('The shortcut ' . $shortcut->getTitle() . ' has been updated.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.