TaxonomyManagerPagesTest.php in Taxonomy Manager 2.0.x
File
src/Tests/TaxonomyManagerPagesTest.php
View source
<?php
namespace Drupal\taxonomy_manager\Tests;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait;
class TaxonomyManagerPagesTest extends BrowserTestBase {
use TaxonomyTestTrait;
private $vocabulary;
private $adminUser;
public static $modules = [
'taxonomy_manager',
];
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer taxonomy',
]);
$this->vocabulary = $this
->createVocabulary();
}
public function testConfigurationPageIsAccessible() {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet("admin/config");
$this
->assertResponse(200);
$this
->assertRaw("Advanced settings for the Taxonomy Manager", "The settings page is accessible.");
$this
->drupalLogout();
}
public function testVocabulariesListIsAccessible() {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet("admin/structure");
$this
->assertResponse(200);
$this
->assertRaw("Administer vocabularies with the Taxonomy Manager", "The link to the page listing vocabularies is accessible.");
$this
->drupalGet("admin/structure/taxonomy_manager/voc");
$this
->assertResponse(200);
$this
->assertRaw("Edit vocabulary settings", "The page listing vocabularies is accessible.");
$this
->drupalLogout();
}
public function testTermsEditingPageIsAccessible() {
$this
->drupalLogin($this->adminUser);
$voc_name = $this->vocabulary
->label();
$this
->drupalGet("admin/structure/taxonomy_manager/voc/{$voc_name}");
$this
->assertResponse(200);
$this
->assertRaw("Taxonomy Manager - {$voc_name}", "The taxonomy manager form for editing terms is accessible.");
$this
->drupalLogout();
}
}