protected function MenuLinkWeightTest::assertMenuLink in Menu Link Weight 8
Same name and namespace in other branches
- 8.2 menu_link_weight.test \MenuLinkWeightTest::assertMenuLink()
- 7 menu_link_weight.test \MenuLinkWeightTest::assertMenuLink()
Fetch the menu item from the database and compare it to the given array.
Parameters
int $mlid: Menu item id.
array $expected_item: Array containing properties to verify.
1 call to MenuLinkWeightTest::assertMenuLink()
- MenuLinkWeightTest::testMenuFunctionality in ./
menu_link_weight.test - Test creating, editing, deleting menu links via node form widget.
File
- ./
menu_link_weight.test, line 286 - Web tests for Menu Link Weight.
Class
- MenuLinkWeightTest
- Test class for Menu Link Weight.
Code
protected 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,
)));
}
}