private function PatternsMenuTestCase::testing_menu_item in Patterns 7
Same name and namespace in other branches
- 7.2 tests/menu/menu.test \PatternsMenuTestCase::testing_menu_item()
1 call to PatternsMenuTestCase::testing_menu_item()
- PatternsMenuTestCase::test_menu in tests/
menu/ menu.test
File
- tests/
menu/ menu.test, line 84 - SimpleTests for the menu component of Patterns.
Class
- PatternsMenuTestCase
- @file SimpleTests for the menu component of Patterns.
Code
private function testing_menu_item() {
$menu_name = 'menu-footer-links';
$link_path = 'http://123.com';
$link_title = 'menu link title';
parent::runFile('menu_item_create.yaml', 'Create menu items', $this->menu_tests_dir);
//select db to verify the result is the same as the variable or not
$result = db_select('menu_links', 'm')
->fields('m', array(
'mlid',
'menu_name',
'link_path',
'link_title',
))
->condition('m.menu_name', $menu_name)
->condition('m.link_path', $link_path)
->condition('m.link_title', $link_title)
->execute()
->fetchAll();
$this
->assertNotNull($result, t('Menu_item was created correctly.'));
parent::runFile('menu_item_modify.yaml', 'Edit menu items', $this->menu_tests_dir);
$menu_nameM = 'menu-footer-links';
$link_pathM = 'http://123.com';
$link_titleM = 'menu link title changed';
$result = db_select('menu_links', 'm')
->fields('m', array(
'menu_name',
'link_path',
'link_title',
))
->condition('m.menu_name', $menu_nameM)
->condition('m.link_path', $link_pathM)
->condition('m.link_title', $link_titleM)
->execute()
->fetchAll();
$this
->assertTrue($result, t('Menu_item was modified correctly.'));
//Menu delete use others to delete verfication
parent::runFile('menu_item_delete.yaml', 'Delete menu items', $this->menu_tests_dir);
$result = db_select('menu_links', 'm')
->fields('m', array(
'menu_name',
'link_path',
'link_title',
))
->condition('m.menu_name', $menu_nameM)
->condition('m.link_path', $link_pathM)
->condition('m.link_title', $link_titleM)
->countQuery()
->execute()
->fetchField();
$this
->assertEqual($result, 0, 'Menu_item was deleted correctly.');
}