You are here

function ShortcutLinksTestCase::testShortcutLinkRename in Drupal 7

Tests that shortcut links can be renamed.

File

modules/shortcut/shortcut.test, line 162
Tests for shortcut.module.

Class

ShortcutLinksTestCase
Defines shortcut links test cases.

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.');
}