function ShortcutLinksTest::testShortcutLinkDelete

Tests deleting a shortcut link.

File

drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php, line 113
Definition of Drupal\shortcut\Tests\ShortcutLinksTest.

Class

ShortcutLinksTest
Defines shortcut links test cases.

Namespace

Drupal\shortcut\Tests

Code

function testShortcutLinkDelete() {
  $set = $this->set;
  $link = reset($set->links);
  $this
    ->drupalPost('admin/config/user-interface/shortcut/link/' . $link->mlid . '/delete', array(), 'Delete');
  $saved_set = shortcut_set_load($set
    ->id());
  $mlids = $this
    ->getShortcutInformation($saved_set, 'mlid');
  $this
    ->assertFalse(in_array($link->mlid, $mlids), 'Successfully deleted a shortcut.');

  // Delete all the remaining shortcut menu links.
  foreach (array_filter($mlids) as $mlid) {
    menu_link_delete($mlid);
  }

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