You are here

public function EntityLoadHelperTest::testLoadEntityDoesntSearchTwiceIfNoUuidIsProvided in YAML Content 8

An entity is not searched by UUID if no UUID is provided.

@covers ::loadEntity

File

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

Class

EntityLoadHelperTest
Test functionality of the EntityLoadHelper class.

Namespace

Drupal\Tests\yaml_content\Unit\EntityLoadHelper

Code

public function testLoadEntityDoesntSearchTwiceIfNoUuidIsProvided() {
  $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
    ->never())
    ->method('loadByUuid');

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