You are here

public function ReferenceAccessTest::assertReferenceCreateAccess in Bibliography & Citation 2.0.x

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

Asserts that reference create access correctly grants or denies access.

Parameters

string $bundle: The reference bundle to check access to.

bool $result: Whether access should be granted or not.

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

string|null $langcode: (optional) The language code indicating which translation of the reference to check. If NULL, the untranslated (fallback) access is checked.

1 call to ReferenceAccessTest::assertReferenceCreateAccess()
ReferenceAccessTest::testReferenceAccess in modules/bibcite_entity/tests/src/Kernel/ReferenceAccessTest.php
Runs basic tests for reference_access function.

File

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

Class

ReferenceAccessTest
Tests basic reference_access functionality.

Namespace

Drupal\Tests\bibcite_entity\Kernel

Code

public function assertReferenceCreateAccess($bundle, $result, AccountInterface $account, $langcode = NULL) {
  $this
    ->assertEquals($result, $this->accessHandler
    ->createAccess($bundle, $account, [
    'langcode' => $langcode,
  ]), $this
    ->referenceAccessAssertMessage('create', $result, $langcode));
}