public function TaxonomyMenuUnitTest::testTaxonomyMenuCustomMenu in Taxonomy menu 7.2
Same name and namespace in other branches
- 7 taxonomy_menu.test \TaxonomyMenuUnitTest::testTaxonomyMenuCustomMenu()
Tests creation of menu links in a custom menu.
File
- tests/
taxonomy_menu.test, line 418 - Defines abstract base test class for the Taxonomy menu module tests.
Class
- TaxonomyMenuUnitTest
- Tests for taxonomy vocabulary functions.
Code
public function testTaxonomyMenuCustomMenu() {
$vocabulary = $this->vocabulary;
$terms = $this->terms_hierarchy;
$custom_menu_name = $this
->randomName(16);
$menu_machine_name = drupal_substr(hash('sha256', $custom_menu_name), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
// Submit the menu creation form.
$menu_edit = array();
$menu_edit['title'] = $custom_menu_name;
$menu_edit['menu_name'] = $menu_machine_name;
$this
->drupalPost('admin/structure/menu/add', $menu_edit, 'Save');
$this
->assertResponse(200);
// Submit the vocabulary edit form.
$vocab_edit = array();
$vocab_edit['taxonomy_menu[vocab_parent]'] = 'menu-' . $menu_machine_name . ':0';
$this
->drupalPost('admin/structure/taxonomy/' . $vocabulary->machine_name . '/edit', $vocab_edit, 'Save');
$this
->assertResponse(200);
// Check that the menu links were created in the custom menu.
$this
->assertEqualNumberTermsMenuLinks(count($terms), $vocabulary, 'menu-' . $menu_machine_name);
}