You are here

public function ReferenceAccessTest::assertReferenceAccess in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/tests/src/Kernel/ReferenceAccessTest.php \Drupal\Tests\bibcite_entity\Kernel\ReferenceAccessTest::assertReferenceAccess()

Asserts that reference access correctly grants or denies access.

Parameters

array $ops: An associative array of the expected reference access grants for the reference and account, with each key as the name of an operation (e.g. 'view', 'delete') and each value a Boolean indicating whether access to that operation should be granted.

\Drupal\bibcite_entity\Entity\ReferenceInterface $reference: The reference object to check.

\Drupal\Core\Session\AccountInterface $account: The user account for which to check access.

2 calls to ReferenceAccessTest::assertReferenceAccess()
ReferenceAccessTest::testReferenceAccess in modules/bibcite_entity/tests/src/Kernel/ReferenceAccessTest.php
Runs basic tests for reference_access function.
ReferenceAccessTest::testUnsupportedOperation in modules/bibcite_entity/tests/src/Kernel/ReferenceAccessTest.php
Test operations not supported by reference grants.

File

modules/bibcite_entity/tests/src/Kernel/ReferenceAccessTest.php, line 271

Class

ReferenceAccessTest
Tests basic reference_access functionality.

Namespace

Drupal\Tests\bibcite_entity\Kernel

Code

public function assertReferenceAccess(array $ops, ReferenceInterface $reference, AccountInterface $account) {
  foreach ($ops as $op => $result) {
    $this
      ->assertEquals($result, $this->accessHandler
      ->access($reference, $op, $account), $this
      ->referenceAccessAssertMessage($op, $result, $reference
      ->language()
      ->getId()));
  }
}