function ShortcutLinksTestCase::testShortcutLinkRename

7.x shortcut.test ShortcutLinksTestCase::testShortcutLinkRename()

Tests that shortcut links can be renamed.

File

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