You are here

public function ShortcutLinksTest::testShortcutLinkRename in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/shortcut/src/Tests/ShortcutLinksTest.php \Drupal\shortcut\Tests\ShortcutLinksTest::testShortcutLinkRename()

Tests that shortcut links can be renamed.

File

core/modules/shortcut/src/Tests/ShortcutLinksTest.php, line 198
Contains \Drupal\shortcut\Tests\ShortcutLinksTest.

Class

ShortcutLinksTest
Create, view, edit, delete, and change shortcut links.

Namespace

Drupal\shortcut\Tests

Code

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

  // Attempt to rename shortcut link.
  $new_link_name = $this
    ->randomMachineName();
  $shortcuts = $set
    ->getShortcuts();
  $shortcut = reset($shortcuts);
  $this
    ->drupalPostForm('admin/config/user-interface/shortcut/link/' . $shortcut
    ->id(), array(
    'title[0][value]' => $new_link_name,
  ), t('Save'));
  $saved_set = ShortcutSet::load($set
    ->id());
  $titles = $this
    ->getShortcutInformation($saved_set, '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.');
  $this
    ->assertText(t('The shortcut @link has been updated.', array(
    '@link' => $new_link_name,
  )));
}