public function TaxonomyMenuFunctionalTest::testTaxonomyMenuVocabularyInterface in Taxonomy menu 7.2
Save, edit and delete a taxonomy vocabulary using the user interface.
File
- tests/
taxonomy_menu.test, line 196 - Defines abstract base test class for the Taxonomy menu module tests.
Class
- TaxonomyMenuFunctionalTest
- Tests the taxonomy vocabulary interface.
Code
public function testTaxonomyMenuVocabularyInterface() {
$menu_name = 'user-menu';
$vocab = $this->vocabulary->machine_name;
// Visit the main taxonomy administration page.
$this
->drupalGet('admin/structure/taxonomy/' . $vocab . '/edit');
// Options for the taxonomy vocabulary edit form.
$edit = array();
// Try to submit a vocabulary when menu location is a root menu item.
$edit['taxonomy_menu[vocab_parent]'] = $menu_name . ':0';
$this
->drupalPost(NULL, $edit, t('Save'));
$this
->assertRaw(t('The Taxonomy menu has been created.'));
// Try to re-submit a vocabulary when an option has changed.
$edit['taxonomy_menu[options_structure][hide_empty_terms]'] = TRUE;
$this
->drupalPost('admin/structure/taxonomy/' . $vocab . '/edit', $edit, t('Save'));
$this
->assertRaw(t('The Taxonomy menu has been updated.'));
// Try to re-submit a vocabulary without changing any option.
$this
->drupalPost('admin/structure/taxonomy/' . $vocab . '/edit', $edit, t('Save'));
$this
->assertRaw(t('The Taxonomy menu was not updated. Nothing to update.'));
// Try to submit a vocabulary removing the menu location.
$edit['taxonomy_menu[vocab_parent]'] = '0';
$this
->drupalPost('admin/structure/taxonomy/' . $vocab . '/edit', $edit, t('Save'));
$this
->assertRaw(t('The Taxonomy menu has been removed.'));
}