function ShortcutSetsTest::testShortcutSetRenameAlreadyExists

Tests renaming a shortcut set to the same name as another set.

File

drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php, line 119
Definition of Drupal\shortcut\Tests\ShortcutSetsTest.

Class

ShortcutSetsTest
Defines shortcut set test cases.

Namespace

Drupal\shortcut\Tests

Code

function testShortcutSetRenameAlreadyExists() {
  $set = $this
    ->generateShortcutSet($this
    ->randomName());
  $existing_label = $this->set
    ->label();
  $this
    ->drupalPost('admin/config/user-interface/shortcut/manage/' . $set
    ->id() . '/edit', array(
    'label' => $existing_label,
  ), t('Save'));
  $this
    ->assertRaw(t('The shortcut set %name already exists. Choose another name.', array(
    '%name' => $existing_label,
  )));
  $set = shortcut_set_load($set
    ->id());
  $this
    ->assertNotEqual($set
    ->label(), $existing_label, format_string('The shortcut set %title cannot be renamed to %new-title because a shortcut set with that title already exists.', array(
    '%title' => $set
      ->label(),
    '%new-title' => $existing_label,
  )));
}