diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-06 03:17:59 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-06 03:17:59 +0000 |
commit | ad3dde00924063853e54b2d966ed8d91a1e640ab (patch) | |
tree | 17d1e2d82f3c0b563380b25439650c8faa279cc3 /modules/menu/menu.test | |
parent | eeccad8c4bb260d5563ad66757da3a561528bedf (diff) | |
download | brdo-ad3dde00924063853e54b2d966ed8d91a1e640ab.tar.gz brdo-ad3dde00924063853e54b2d966ed8d91a1e640ab.tar.bz2 |
#322703 by BarisW, sun, Shai, and dman: Use on/off checkbox to enable and prepopulate node's menu item.
Diffstat (limited to 'modules/menu/menu.test')
-rw-r--r-- | modules/menu/menu.test | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/modules/menu/menu.test b/modules/menu/menu.test index 38a44539c..9eab7ee13 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -511,3 +511,88 @@ class MenuTestCase extends DrupalWebTestCase { } } } + +/** + * Test menu settings for nodes. + */ +class MenuNodeTestCase extends DrupalWebTestCase { + public static function getInfo() { + return array( + 'name' => 'Menu settings for nodes', + 'description' => 'Add, edit, and delete a node with menu link.', + 'group' => 'Menu', + ); + } + + function setUp() { + parent::setUp('menu'); + + $this->admin_user = $this->drupalCreateUser(array( + 'access administration pages', + 'administer content types', + 'administer menu', + 'create page content', + 'edit any page content', + 'delete any page content', + )); + $this->drupalLogin($this->admin_user); + } + + /** + * Test creating, editing, deleting menu links via node form widget. + */ + function testMenuNodeFormWidget() { + // Enable Navigation menu as available menu. + $edit = array( + 'menu_options[navigation]' => 1, + ); + $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); + // Change default parent item to Navigation menu, so we can assert more + // easily. + $edit = array( + 'menu_parent' => 'navigation:0', + ); + $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); + + // Create a node. + $node_title = $this->randomName(); + $edit = array( + 'title[zxx][0][value]' => $node_title, + 'body[zxx][0][value]' => $this->randomString(), + ); + $this->drupalPost('node/add/page', $edit, t('Save')); + $node = $this->drupalGetNodeByTitle($node_title); + // Assert that there is no link for the node. + $this->drupalGet(''); + $this->assertNoLink($node_title); + + // Edit the node, enable the menu link setting, but skip the link title. + $edit = array( + 'menu[enabled]' => 1, + ); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); + // Assert that there is no link for the node. + $this->drupalGet(''); + $this->assertNoLink($node_title); + + // Edit the node and create a menu link. + $edit = array( + 'menu[enabled]' => 1, + 'menu[link_title]' => $node_title, + ); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); + // Assert that the link exists. + $this->drupalGet(''); + $this->assertLink($node_title); + + // Edit the node and remove the menu link. + $edit = array( + 'menu[enabled]' => FALSE, + ); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); + // Assert that there is no link for the node. + $this->drupalGet(''); + $this->assertNoLink($node_title); + } +} + |