function ShortcutLinksTest::testShortcutLinkRename

Tests that shortcut links can be renamed.

File

drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php, line 76
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(10);
  $this
    ->drupalPost('admin/config/user-interface/shortcut/link/' . $set->links[0]['mlid'], array(
    'shortcut_link[link_title]' => $new_link_name,
    'shortcut_link[link_path]' => $set->links[0]['link_path'],
  ), t('Save'));
  $saved_set = shortcut_set_load($set->set_name);
  $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.');
}