You are here

function MenuTreeDataTestCase::testMenuTreeData in SimpleTest 7

Validate the generation of a proper menu tree hierarchy.

File

tests/menu.test, line 311
Provides SimpleTests for menu.inc.

Class

MenuTreeDataTestCase
Menu tree data related tests.

Code

function testMenuTreeData() {
  $tree = menu_tree_data($this->links);

  // Validate that parent items #1, #2, and #5 exist on the root level.
  $this
    ->assertSameLink($this->links[1], $tree[1]['link'], t('Parent item #1 exists.'));
  $this
    ->assertSameLink($this->links[2], $tree[2]['link'], t('Parent item #2 exists.'));
  $this
    ->assertSameLink($this->links[5], $tree[5]['link'], t('Parent item #5 exists.'));

  // Validate that child item #4 exists at the correct location in the hierarchy.
  $this
    ->assertSameLink($this->links[4], $tree[2]['below'][3]['below'][4]['link'], t('Child item #4 exists in the hierarchy.'));
}