public function TaxonomyMenuWebTestCase::assertMenuLink in Taxonomy menu 7.2
Fetches the menu item from the database and compare it to the specified array.
Parameters
$mlid: The identifier of a menu link.
$expected_item: An array containing properties to verify.
2 calls to TaxonomyMenuWebTestCase::assertMenuLink()
- TaxonomyMenuConfigurationTest::testTaxonomyMenuCountNodes in tests/
taxonomy_menu.test - Tests Taxonommy Menu "Node count" option.
- TaxonomyMenuConfigurationTest::testTaxonomyMenuHideEmptyTerms in tests/
taxonomy_menu.test - Tests Taxonommy Menu "Hide Empty terms" option.
File
- tests/
taxonomy_menu.test, line 94 - Defines abstract base test class for the Taxonomy menu module tests.
Class
- TaxonomyMenuWebTestCase
- Abstract class for Taxonomy menu testing. All Taxonomy menu tests should extend this class.
Code
public 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, t('Parameter %key had expected value.', array(
'%key' => $key,
)));
}
}