public function EntityLoadHelperTest::testLoadEntityWithPropertiesReturnsFalseWithNoMatches in YAML Content 8
Test that loadEntity returns false if property searching returned no matches.
@covers ::loadEntity
File
- tests/src/ Unit/ EntityLoadHelper/ EntityLoadHelperTest.php, line 312 
Class
- EntityLoadHelperTest
- Test functionality of the EntityLoadHelper class.
Namespace
Drupal\Tests\yaml_content\Unit\EntityLoadHelperCode
public function testLoadEntityWithPropertiesReturnsFalseWithNoMatches() {
  $this->loadHelper = $this
    ->getEntityLoadHelperMock([
    'loadByUuid',
    'loadByProperties',
  ]);
  // Prepare the parameters.
  $entity_type = 'test_entity';
  // Do not include a UUID property.
  $content_data = [
    'entity' => 'test_entity',
  ];
  // Mock that loadByProperties found no matches.
  $this->loadHelper
    ->method('loadByProperties')
    ->willReturn(FALSE);
  // Execute the method.
  $actual = $this->loadHelper
    ->loadEntity($entity_type, $content_data);
  // Confirm the return value.
  $this
    ->assertFalse($actual);
}