function MenuRouterTestCase::testMenuHierarchy

Tests for menu hierarchy.

File

modules/simpletest/tests/menu.test, line 415

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.