public function EntityLoadHelperTest::testLoadEntityWithUuidReturnsFalseWithNoMatches in YAML Content 8
Test that loadEntity returns false if UUID searching returned no matches.
@covers ::loadEntity
File
- tests/
src/ Unit/ EntityLoadHelper/ EntityLoadHelperTest.php, line 251
Class
- EntityLoadHelperTest
- Test functionality of the EntityLoadHelper class.
Namespace
Drupal\Tests\yaml_content\Unit\EntityLoadHelperCode
public function testLoadEntityWithUuidReturnsFalseWithNoMatches() {
$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',
];
// Mock that loadByUuid found no matches.
$this->loadHelper
->method('loadByUuid')
->willReturn(FALSE);
// Execute the method.
$actual = $this->loadHelper
->loadEntity($entity_type, $content_data);
// Confirm the return value.
$this
->assertFalse($actual);
}