function ShortcutLinksTest::testShortcutLinkRename

Tests that shortcut links can be renamed.

File

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

Class

ShortcutLinksTest
Defines shortcut links test cases.

Namespace

Drupal\shortcut\Tests

Code

function testShortcutLinkRename() {
  $set = $this->set;

  // Attempt to rename shortcut link.
  $new_link_name = $this
    ->randomName();
  $link = reset($set->links);
  $this
    ->drupalPost('admin/config/user-interface/shortcut/link/' . $link->mlid, array(
    'shortcut_link[link_title]' => $new_link_name,
    'shortcut_link[link_path]' => $link->link_path,
  ), t('Save'));
  $saved_set = shortcut_set_load($set
    ->id());
  $titles = $this
    ->getShortcutInformation($saved_set, 'link_title');
  $this
    ->assertTrue(in_array($new_link_name, $titles), 'Shortcut renamed: ' . $new_link_name);
  $this
    ->assertLink($new_link_name, 0, 'Renamed shortcut link appears on the page.');
}