You are here

public function EntityLoadHelperTest::testLoadEntityLoadsByPropertiesIfUuidIsUnavailable in YAML Content 8

An entity is searched by properties if no UUID is defined.

@covers ::loadEntity

File

tests/src/Unit/EntityLoadHelper/EntityLoadHelperTest.php, line 222

Class

EntityLoadHelperTest
Test functionality of the EntityLoadHelper class.

Namespace

Drupal\Tests\yaml_content\Unit\EntityLoadHelper

Code

public function testLoadEntityLoadsByPropertiesIfUuidIsUnavailable() {
  $this->loadHelper = $this
    ->getEntityLoadHelperMock([
    'loadByUuid',
    'loadByProperties',
  ]);

  // Prepare the parameters.
  $entity_type = 'test_entity';

  // Do not include a UUID property.
  $content_data = [
    'entity' => 'test_entity',
  ];
  $this->loadHelper
    ->expects($this
    ->once())
    ->method('loadByProperties')
    ->with($entity_type, $content_data);

  // Execute the method.
  $this->loadHelper
    ->loadEntity($entity_type, $content_data);
}