You are here

public function ConfigEntityReferenceTest::testPrepareValue in Feeds 8.3

Tests finding an entity by ID.

@covers ::prepareValue @covers ::findEntity

File

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

Class

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

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testPrepareValue() {
  $this->entityFinder
    ->findEntities($this
    ->getReferencableEntityTypeId(), 'id', 'foo')
    ->willReturn([
    'foo',
  ])
    ->shouldBeCalled();
  $method = $this
    ->getProtectedClosure($this
    ->createTargetPluginInstance(), 'prepareValue');
  $values = [
    'target_id' => 'foo',
  ];
  $method(0, $values);
  $this
    ->assertSame($values, [
    'target_id' => 'foo',
  ]);
}