You are here

protected function VocabularyAccessTest::assertVocabularyAccess in Taxonomy access fix 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/VocabularyAccessTest.php \Drupal\Tests\taxonomy_access_fix\Functional\VocabularyAccessTest::assertVocabularyAccess()

Checks access to Taxonomy Vocabulary entity.

Parameters

\Drupal\taxonomy\VocabularyInterface $vocabulary: A Taxonomy Vocabulary entity.

bool $access_operation: The entity operation, e.g. 'view', 'edit', 'delete', etc.

bool $access_allowed: Whether the current user has access to the given operation or not.

string $access_reason: (optional) The reason of the access result.

1 call to VocabularyAccessTest::assertVocabularyAccess()
VocabularyAccessTest::testTaxonomyVocabularyOperations in tests/src/Functional/VocabularyAccessTest.php
Tests access to entity operations on Taxonomy Vocabulary entities.

File

tests/src/Functional/VocabularyAccessTest.php, line 703

Class

VocabularyAccessTest
Tests administrative Taxonomy UI access.

Namespace

Drupal\Tests\taxonomy_access_fix\Functional

Code

protected function assertVocabularyAccess(VocabularyInterface $vocabulary, $access_operation, $access_allowed, $access_reason = '') {
  $access_result = $vocabulary
    ->access($access_operation, NULL, TRUE);
  $this
    ->assertSame($access_allowed, $access_result
    ->isAllowed());
  if ($access_reason) {
    $this
      ->assertSame($access_reason, $access_result
      ->getReason());
  }
}