You are here

function MenuIncTestCase::testMenuHiearchy in SimpleTest 7

Tests for menu hiearchy.

File

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

Class

MenuIncTestCase
@file Provides SimpleTests for menu.inc.

Code

function testMenuHiearchy() {
  $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'], t('The parent of a directly attached child is correct.'));
  $this
    ->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], t('The parent of a non-directly attached child is correct.'));
}