public function TaxonomyMenuFunctionalTest::testTaxonomyMenuTermsOverviewInterface in Taxonomy menu 8
Re-order terms on the terms' overview page.
File
- lib/
Drupal/ taxonomy_menu/ Tests/ TaxonomyMenuFunctionalTest.php, line 72 - Contains \Drupal\taxonomy_menu\Tests\TaxonomyMenuFunctionalTest.
Class
- TaxonomyMenuFunctionalTest
- Tests the taxonomy vocabulary interface.
Namespace
Drupal\taxonomy_menu\TestsCode
public function testTaxonomyMenuTermsOverviewInterface() {
$this->terms_hierarchy = $this
->createTermsHierarchy($this->vocabulary
->id());
// Last term of our hierarchy.
$term7 = $this->terms_hierarchy[7];
// Submit the main taxonomy administration page.
$edit = array(
'taxonomy_menu[vocab_parent]' => 'main:0',
'taxonomy_menu[sync]' => TRUE,
);
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary
->id(), $edit, t('Save'));
// Visit the terms overview page.
$this
->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview');
// Take last term, place it on top and save.
$edit = array(
'terms[tid:' . $term7
->id() . ':0][term][tid]' => $term7
->id(),
'terms[tid:' . $term7
->id() . ':0][term][parent]' => 0,
'terms[tid:' . $term7
->id() . ':0][term][depth]' => 0,
'terms[tid:' . $term7
->id() . ':0][weight]' => -5,
);
$this
->drupalPostForm(NULL, $edit, t('Save'));
$this
->assertRaw(t('The Taxonomy menu has been updated.'));
// Test "Reset to alphabetical".
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview', array(), t('Reset to alphabetical'));
$this
->drupalPostForm(NULL, array(), t('Reset to alphabetical'));
$this
->assertRaw(t('The Taxonomy menu has been updated.'));
}