public function TaxonomyMenuConfigurationTest::testTaxonomyMenuSyncOption in Taxonomy menu 7.2
Tests Taxonommy Menu sync option.
File
- tests/
taxonomy_menu.test, line 477 - Defines abstract base test class for the Taxonomy menu module tests.
Class
- TaxonomyMenuConfigurationTest
- Tests Taxonomy menu configuration options.
Code
public function testTaxonomyMenuSyncOption() {
$vocab = $this->vocabulary->machine_name;
// Set settings (no sync on main-menu).
$edit = array(
'taxonomy_menu[vocab_parent]' => 'main-menu:0',
'taxonomy_menu[sync]' => FALSE,
);
$this
->drupalPost('admin/structure/taxonomy/' . $vocab . '/edit', $edit, t('Save'));
$this
->assertResponse(200);
// Prepare changes.
$new_name = $this
->randomName(12);
$test_term = $this->terms_hierarchy[3];
// Arbitrary term from hierarchy
$test_term->name = $new_name;
// Save new term's name with sync option off.
taxonomy_term_save($test_term);
$mlid = _taxonomy_menu_get_mlid($test_term->tid, $this->vocabulary->vid);
$menu_link = menu_link_load($mlid);
$this
->assertNotEqual($new_name, $menu_link['link_title']);
// Switch to sync option on and save.
$edit['taxonomy_menu[sync]'] = TRUE;
$this
->drupalPost('admin/structure/taxonomy/' . $vocab . '/edit', $edit, t('Save'));
$this
->assertResponse(200);
$mlid = _taxonomy_menu_get_mlid($test_term->tid, $this->vocabulary->vid);
$menu_link = menu_link_load($mlid);
$this
->assertEqual($new_name, $menu_link['link_title']);
}