public function EntityLoadHelperTest::testLoadEntityLoadsUuidFirstIfAvailable in YAML Content 8
An entity is searched by UUID first if one is provided.
@covers ::loadEntity
File
- tests/
src/ Unit/ EntityLoadHelper/ EntityLoadHelperTest.php, line 141
Class
- EntityLoadHelperTest
- Test functionality of the EntityLoadHelper class.
Namespace
Drupal\Tests\yaml_content\Unit\EntityLoadHelperCode
public function testLoadEntityLoadsUuidFirstIfAvailable() {
$this->loadHelper = $this
->getEntityLoadHelperMock([
'loadByUuid',
'loadByProperties',
]);
// Prepare the parameters.
$entity_type = 'test_entity';
$content_data = [
'entity' => 'test_entity',
// Include a UUID property.
'uuid' => '3c6485e4-69a3-429d-8ab1-3e7df48747bc',
];
$this->loadHelper
->expects($this
->once())
->method('loadByUuid')
->with($entity_type, $content_data['uuid']);
// Execute the method.
$this->loadHelper
->loadEntity($entity_type, $content_data);
}