You are here

public function EntityLoadHelperTest::testEntityExistsAttemptsToLoadEntity in YAML Content 8

Test entityExists uses content data to load matching entities.

@covers ::entityExists @covers ::loadEntity

File

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

Class

EntityLoadHelperTest
Test functionality of the EntityLoadHelper class.

Namespace

Drupal\Tests\yaml_content\Unit\EntityLoadHelper

Code

public function testEntityExistsAttemptsToLoadEntity() {
  $this->loadHelper = $this
    ->getEntityLoadHelperMock([
    'loadEntity',
  ]);

  // Prepare arguments to be tested.
  $entity_type = 'text_entity';
  $content_data = [
    'entity' => 'test_entity',
    'type' => 'tester',
    'name' => 'Test Entity',
  ];

  // Prepare expectations.
  $this->loadHelper
    ->expects($this
    ->once())
    ->method('loadEntity')
    ->with($entity_type, $content_data);

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