You are here

protected function BlazyCreationTestTrait::createReferencingEntity in Blazy 8.2

Same name and namespace in other branches
  1. 8 tests/src/Traits/BlazyCreationTestTrait.php \Drupal\Tests\blazy\Traits\BlazyCreationTestTrait::createReferencingEntity()

Create referencing entity.

1 call to BlazyCreationTestTrait::createReferencingEntity()
BlazyViewsFileTest::buildContents in tests/src/Kernel/Views/BlazyViewsFileTest.php
Build contents.

File

tests/src/Traits/BlazyCreationTestTrait.php, line 460

Class

BlazyCreationTestTrait
A Trait common for Blazy tests.

Namespace

Drupal\Tests\blazy\Traits

Code

protected function createReferencingEntity(array $data = []) {
  if (empty($data['values']) && $this->referencedEntity
    ->id()) {
    $data['values'] = [
      $this->entityFieldName => [
        [
          'target_id' => $this->referencedEntity
            ->id(),
        ],
      ],
    ];
  }
  return $this
    ->setUpContentWithItems($this->bundle, $data);
}