You are here

public function ConfigEntityReferenceTest::testPrepareValueReferenceNotFound in Feeds 8.3

Tests prepareValue() method without match.

@covers ::prepareValue @covers ::findEntity

File

tests/src/Unit/Feeds/Target/ConfigEntityReferenceTest.php, line 80

Class

ConfigEntityReferenceTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\ConfigEntityReference @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testPrepareValueReferenceNotFound() {
  $this->entityFinder
    ->findEntities($this
    ->getReferencableEntityTypeId(), 'id', 'bar')
    ->willReturn([])
    ->shouldBeCalled();
  $method = $this
    ->getProtectedClosure($this
    ->createTargetPluginInstance(), 'prepareValue');
  $values = [
    'target_id' => 'bar',
  ];
  $this
    ->expectException(ReferenceNotFoundException::class);
  $this
    ->expectExceptionMessage("Referenced entity not found for field <em class=\"placeholder\">id</em> with value <em class=\"placeholder\">bar</em>.");
  $method(0, $values);
}