You are here

public function ShortcutLinksTest::testShortcutLinkDelete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/shortcut/src/Tests/ShortcutLinksTest.php \Drupal\shortcut\Tests\ShortcutLinksTest::testShortcutLinkDelete()

Tests deleting a shortcut link.

File

core/modules/shortcut/src/Tests/ShortcutLinksTest.php, line 252
Contains \Drupal\shortcut\Tests\ShortcutLinksTest.

Class

ShortcutLinksTest
Create, view, edit, delete, and change shortcut links.

Namespace

Drupal\shortcut\Tests

Code

public function testShortcutLinkDelete() {
  $set = $this->set;
  $shortcuts = $set
    ->getShortcuts();
  $shortcut = reset($shortcuts);
  $this
    ->drupalPostForm('admin/config/user-interface/shortcut/link/' . $shortcut
    ->id() . '/delete', array(), 'Delete');
  $saved_set = ShortcutSet::load($set
    ->id());
  $ids = $this
    ->getShortcutInformation($saved_set, 'id');
  $this
    ->assertFalse(in_array($shortcut
    ->id(), $ids), 'Successfully deleted a shortcut.');

  // Delete all the remaining shortcut links.
  entity_delete_multiple('shortcut', array_filter($ids));

  // Get the front page to check that no exceptions occur.
  $this
    ->drupalGet('');
}