TaxonomyMenuCustomPathFunctionalTest.php in Taxonomy menu 8
File
lib/Drupal/taxonomy_menu/Tests/TaxonomyMenuCustomPathFunctionalTest.php
View source
<?php
namespace Drupal\taxonomy_menu\Tests;
class TaxonomyMenuCustomPathFunctionalTest extends TaxonomyMenuWebTestCase {
public static $modules = array(
'taxonomy_menu_custom_paths',
'taxonomy_menu_dummy_paths',
);
public static function getInfo() {
return array(
'name' => 'Custom path - Vocabulary interface',
'description' => 'Test taxonomy menu custom path interface.',
'group' => 'Taxonomy menu',
);
}
public function setUp() {
parent::setUp();
$admin_user = $this
->drupalCreateUser(array(
'administer taxonomy',
'administer menu',
'bypass node access',
));
$this
->drupalLogin($admin_user);
$this->vocabulary = $this
->createVocabulary();
$this->terms_hierarchy = $this
->createTermsHierarchy();
}
public function testTaxonomyMenuCustomPathVocabularyInterface() {
$edit = array(
'taxonomy_menu[vocab_parent]' => 'main:0',
'taxonomy_menu[path]' => 'taxonomy_menu_path_custom',
'taxonomy_menu[options_custom_path][custom_path_base]' => '',
);
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary
->id(), $edit, t('Save'));
$this
->assertRaw(t('A base path must be provided when using a custom path.'));
$edit['taxonomy_menu[options_custom_path][custom_path_base]'] = 'custom_base_path';
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary
->id(), $edit, t('Save'));
$this
->assertRaw(t('The Taxonomy menu has been created.'));
$edit['taxonomy_menu[options_custom_path][custom_path_depth]'] = '5';
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary
->id(), $edit, t('Save'));
$this
->assertRaw(t('The Taxonomy menu has been updated.'));
db_delete('router')
->condition('path', '/custom_base_path/{tid}/{depth}')
->execute();
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary
->id(), $edit, t('Save'));
$this
->assertRaw(t('The path custom_base_path/%/% is not available in Drupal. This is required to use custom paths.'));
db_delete('router')
->condition('path', '/custom_base_path/{tid}')
->execute();
$this
->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary
->id(), $edit, t('Save'));
$this
->assertRaw(t('The path custom_base_path/%/% is not available in Drupal. This is required to use custom paths.'));
}
}