You are here

private function ReferenceAccessTest::createReference 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::createReference()

Creates a reference based on default settings.

Parameters

array $settings: (optional) An associative array of settings for the reference, as used in Reference::create(). Override the defaults by specifying the key and value in the array.

Return value

\Drupal\bibcite_entity\Entity\ReferenceInterface The created reference entity.

Throws

\Drupal\Core\Entity\EntityStorageException

2 calls to ReferenceAccessTest::createReference()
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 336

Class

ReferenceAccessTest
Tests basic reference_access functionality.

Namespace

Drupal\Tests\bibcite_entity\Kernel

Code

private function createReference(array $settings = []) {

  // Populate defaults array.
  $settings += [
    'title' => $this
      ->randomMachineName(8),
    'type' => 'miscellaneous',
    'uid' => \Drupal::currentUser()
      ->id(),
  ];
  $reference = Reference::create($settings);
  $reference
    ->save();
  return $reference;
}