public function TaxonomyMenuCustomPathConfigurationTest::testTaxonomyMenuCustomPathDepthOption in Taxonomy menu 7.2
Tests if the path is correct with both the base path and the depth option.
File
- taxonomy_menu_custom_paths/
tests/ taxonomy_menu_custom_paths.test, line 148 - Tests for taxonomy_menu_custom_paths.module.
Class
- TaxonomyMenuCustomPathConfigurationTest
- Tests Taxonomy Menu Custom Path configuration options.
Code
public function testTaxonomyMenuCustomPathDepthOption() {
// Set a base path and submit the vocabulary interface form.
$edit = array(
'taxonomy_menu[vocab_parent]' => 'main-menu:0',
'taxonomy_menu[path]' => 'taxonomy_menu_path_custom',
'taxonomy_menu[options_custom_path][custom_path_base]' => 'custom_base_path',
'taxonomy_menu[options_custom_path][custom_path_depth]' => '2',
);
$this
->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/edit', $edit, t('Save'));
$this
->assertResponse(200);
// Assert that the depth is used in URLs of menu links.
$mlid = _taxonomy_menu_get_mlid($this->terms_hierarchy[3]->tid, $this->vocabulary->vid);
$menu_link_parent = menu_link_load($mlid);
$this
->assertEqual("custom_base_path/3+4/2", $menu_link_parent['link_path']);
$mlid = _taxonomy_menu_get_mlid($this->terms_hierarchy[4]->tid, $this->vocabulary->vid);
$menu_link_leaf = menu_link_load($mlid);
$this
->assertEqual("custom_base_path/4/2", $menu_link_leaf['link_path']);
}