You are here

function ShortcutLinksTestCase::testShortcutLinkChangePath in Drupal 7

Tests that changing the path of a shortcut link works.

File

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

Class

ShortcutLinksTestCase
Defines shortcut links test cases.

Code

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

  // Tests changing a shortcut path.
  $new_link_path = 'admin/config';
  $this
    ->drupalPost('admin/config/user-interface/shortcut/link/' . $set->links[0]['mlid'], array(
    'shortcut_link[link_title]' => $set->links[0]['link_title'],
    'shortcut_link[link_path]' => $new_link_path,
  ), t('Save'));
  $saved_set = shortcut_set_load($set->set_name);
  $paths = $this
    ->getShortcutInformation($saved_set, 'link_path');
  $this
    ->assertTrue(in_array($new_link_path, $paths), 'Shortcut path changed: ' . $new_link_path);
  $this
    ->assertLinkByHref($new_link_path, 0, 'Shortcut with new path appears on the page.');
}