public function VocabularyPermissionsTest::testVocabularyPermissionsVocabulary in Drupal 8
Same name and namespace in other branches
- 9 core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php \Drupal\Tests\taxonomy\Functional\VocabularyPermissionsTest::testVocabularyPermissionsVocabulary()
Create, edit and delete a vocabulary via the user interface.
File
- core/
modules/ taxonomy/ tests/ src/ Functional/ VocabularyPermissionsTest.php, line 37
Class
- VocabularyPermissionsTest
- Tests the taxonomy vocabulary permissions.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
public function testVocabularyPermissionsVocabulary() {
// VocabularyTest.php already tests for user with "administer taxonomy"
// permission.
// Test as user without proper permissions.
$authenticated_user = $this
->drupalCreateUser([]);
$this
->drupalLogin($authenticated_user);
$assert_session = $this
->assertSession();
// Visit the main taxonomy administration page.
$this
->drupalGet('admin/structure/taxonomy');
$assert_session
->statusCodeEquals(403);
// Test as user with "access taxonomy overview" permissions.
$proper_user = $this
->drupalCreateUser([
'access taxonomy overview',
]);
$this
->drupalLogin($proper_user);
// Visit the main taxonomy administration page.
$this
->drupalGet('admin/structure/taxonomy');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains('Vocabulary name');
$assert_session
->linkNotExists('Add vocabulary');
}