You are here

public function UserRoleTest::testPrepareValue in Feeds 8.3

Tests finding a role by label.

@covers ::prepareValue @covers ::findEntity

File

tests/src/Unit/Feeds/Target/UserRoleTest.php, line 117

Class

UserRoleTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\UserRole @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

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