function MenuTestCase::assertMenuLink

Fetch the menu item from the database and compare it to the specified array.

Parameters

$mlid: Menu item id.

$item: Array containing properties to verify.

4 calls to MenuTestCase::assertMenuLink()
MenuTestCase::addMenuLink in modules/menu/menu.test
Add a menu link using the menu module UI.
MenuTestCase::disableMenuLink in modules/menu/menu.test
Disable a menu link.
MenuTestCase::doMenuTests in modules/menu/menu.test
Test menu functionality using navigation menu.
MenuTestCase::enableMenuLink in modules/menu/menu.test
Enable a menu link.

File

modules/menu/menu.test, line 542

Class

MenuTestCase
@file Tests for menu.module.

Code

function assertMenuLink($mlid, array $expected_item) {
    // Retrieve menu link.
    $item = db_query('SELECT * FROM {menu_links} WHERE mlid = :mlid', array(
        ':mlid' => $mlid,
    ))->fetchAssoc();
    $options = unserialize($item['options']);
    if (!empty($options['query'])) {
        $item['link_path'] .= '?' . drupal_http_build_query($options['query']);
    }
    if (!empty($options['fragment'])) {
        $item['link_path'] .= '#' . $options['fragment'];
    }
    foreach ($expected_item as $key => $value) {
        $this->assertEqual($item[$key], $value, format_string('Parameter %key had expected value.', array(
            '%key' => $key,
        )));
    }
}

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