You are here

function TaxonomyMenuUnitTest::testTaxonomyMenuCustomMenu in Taxonomy menu 7

Same name and namespace in other branches
  1. 7.2 tests/taxonomy_menu.test \TaxonomyMenuUnitTest::testTaxonomyMenuCustomMenu()

File

./taxonomy_menu.test, line 109
Tests for taxonomy_menu.module.

Class

TaxonomyMenuUnitTest
Tests for taxonomy vocabulary functions.

Code

function testTaxonomyMenuCustomMenu() {

  // Create a custom menu.
  $edit = array();
  $custom_name = $this
    ->randomName(16);
  $machine_name = drupal_substr(hash('sha256', $custom_name), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
  $edit['title'] = $custom_name;
  $edit['menu_name'] = $machine_name;
  $this
    ->drupalPost('admin/structure/menu/add', $edit, 'Save');

  // Move the menu block to a region.
  $edit = array();
  $edit['blocks[menu_menu-' . $machine_name . '][region]'] = 'sidebar_first';
  $this
    ->drupalPost('admin/structure/block', $edit, 'Save blocks');
  $this
    ->assertResponse(200);
  $edit = array();
  $edit['taxonomy_menu[vocab_parent]'] = 'menu-' . $machine_name . ':0';
  $this
    ->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/edit', $edit, 'Save');
  $term = $this->term;
  $this
    ->drupalGet('<front>');
  $this
    ->assertLink($term->name);
  $term = $this->term;
  taxonomy_term_delete($term->tid);
  $this
    ->drupalGet('<front>');
  $this
    ->assertNoLink($term->name);
}