public function TaxonomyMenuConfigurationTest::testTaxonomyMenuSyncOption in Taxonomy menu 8
Tests Taxonommy Menu sync option.
File
- lib/
Drupal/ taxonomy_menu/ Tests/ TaxonomyMenuConfigurationTest.php, line 44 - Contains \Drupal\taxonomy_menu\Tests\TaxonomyMenuConfigurationTest.
Class
- TaxonomyMenuConfigurationTest
- Tests Taxonomy menu configuration options.
Namespace
Drupal\taxonomy_menu\TestsCode
public function testTaxonomyMenuSyncOption() {
$vid = $this->vocabulary
->id();
// Set settings (no sync on main).
$edit = array(
'taxonomy_menu[vocab_parent]' => 'main:0',
'taxonomy_menu[sync]' => FALSE,
);
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $vid, $edit, t('Save'));
$this
->assertResponse(200);
// Prepare changes.
$new_name = $this
->randomName(12);
// Arbitrary term from hierarchy.
$test_term = $this->terms_hierarchy[3];
$test_term
->setName($new_name);
$test_term
->save();
$mlid = _taxonomy_menu_get_mlid($test_term
->id(), $this->vocabulary
->id());
$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
->drupalPostForm('admin/structure/taxonomy/manage/' . $vid, $edit, t('Save'));
$this
->assertResponse(200);
$mlid = _taxonomy_menu_get_mlid($test_term
->id(), $this->vocabulary
->id());
$menu_link = menu_link_load($mlid);
$this
->assertEqual($new_name, $menu_link['link_title']);
}