public function ShortcutLinksTest::testShortcutLinkDelete in Drupal 9
Same name and namespace in other branches
- 8 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkDelete()
Tests deleting a shortcut link.
File
- core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutLinksTest.php, line 291
Class
- ShortcutLinksTest
- Create, view, edit, delete, and change shortcut links.
Namespace
Drupal\Tests\shortcut\FunctionalCode
public function testShortcutLinkDelete() {
$set = $this->set;
$shortcuts = $set
->getShortcuts();
$shortcut = reset($shortcuts);
$this
->drupalGet('admin/config/user-interface/shortcut/link/' . $shortcut
->id() . '/delete');
$this
->submitForm([], 'Delete');
$saved_set = ShortcutSet::load($set
->id());
$ids = $this
->getShortcutInformation($saved_set, 'id');
$this
->assertNotContains($shortcut
->id(), $ids, 'Successfully deleted a shortcut.');
// Delete all the remaining shortcut links.
$storage = \Drupal::entityTypeManager()
->getStorage('shortcut');
$storage
->delete($storage
->loadMultiple(array_filter($ids)));
// Get the front page to check that no exceptions occur.
$this
->drupalGet('');
}