diff options
Diffstat (limited to 'modules/menu/menu.test')
-rw-r--r-- | modules/menu/menu.test | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/menu/menu.test b/modules/menu/menu.test index 284f55541..2b00b9798 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -95,8 +95,10 @@ class MenuTestCase extends DrupalWebTestCase { */ function addCustomMenu() { // Add custom menu. + + // Try adding a menu using a menu_name that is too long. $this->drupalGet('admin/build/menu/add'); - $menu_name = substr(md5($this->randomName(16)), 0, 20); + $menu_name = substr(md5($this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI + 1); $title = $this->randomName(16); $edit = array ( 'menu_name' => $menu_name, @@ -104,6 +106,17 @@ class MenuTestCase extends DrupalWebTestCase { 'title' => $title, ); $this->drupalPost('admin/build/menu/add', $edit, t('Save')); + + // Verify that using a menu_name that is too long results in a validation message. + $this->assertText(format_plural(MENU_MAX_MENU_NAME_LENGTH_UI, "The menu name can't be longer than 1 character.", "The menu name can't be longer than @count characters."), t('Validation failed when menu name is too long.')); + + // Change the menu_name so it no longer exceeds the maximum length. + $menu_name = substr(md5($this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI); + $edit['menu_name'] = $menu_name; + $this->drupalPost('admin/build/menu/add', $edit, t('Save')); + + // Verify that no validation error is given for menu_name length. + $this->assertNoText(format_plural(MENU_MAX_MENU_NAME_LENGTH_UI, "The menu name can't be longer than 1 character.", "The menu name can't be longer than @count characters."), t('Validation failed when menu name is too long.')); // Unlike most other modules, there is no confirmation message displayed. $this->drupalGet('admin/build/menu'); |