You are here

function MenuRouterTestCase::testMenuHierarchy in Drupal 7

Tests for menu hierarchy.

File

modules/simpletest/tests/menu.test, line 415
Provides SimpleTests for menu.inc.

Class

MenuRouterTestCase

Code

function testMenuHierarchy() {
  $parent_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(
    ':link_path' => 'menu-test/hierarchy/parent',
  ))
    ->fetchAssoc();
  $child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(
    ':link_path' => 'menu-test/hierarchy/parent/child',
  ))
    ->fetchAssoc();
  $unattached_child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(
    ':link_path' => 'menu-test/hierarchy/parent/child2/child',
  ))
    ->fetchAssoc();
  $this
    ->assertEqual($child_link['plid'], $parent_link['mlid'], 'The parent of a directly attached child is correct.');
  $this
    ->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], 'The parent of a non-directly attached child is correct.');
}