You are here

public function EntityReferenceTest::testPrepareValue in Feeds 8.3

@covers ::prepareValue @covers ::findEntities

File

tests/src/Unit/Feeds/Target/EntityReferenceTest.php, line 85

Class

EntityReferenceTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\EntityReference @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testPrepareValue() {
  $this->entityFinder
    ->findEntities('referenceable_entity_type', 'referenceable_entity_type label', 1, [])
    ->willReturn([
    12,
    13,
    14,
  ])
    ->shouldBeCalled();
  $method = $this
    ->getProtectedClosure($this
    ->createTargetPluginInstance(), 'prepareValue');
  $values = [
    'target_id' => 1,
  ];
  $method(0, $values);
  $this
    ->assertSame($values, [
    'target_id' => 12,
  ]);
}