You are here

function ShortcutSetsTestCase::testShortcutSetRenameAlreadyExists in Drupal 7

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

File

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

Class

ShortcutSetsTestCase
Defines shortcut set test cases.

Code

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