You are here

public function LinkTest::testPrepareValue in Feeds 8.3

@covers ::prepareValue

@dataProvider providerUris

Parameters

string $expected_uri: The expected uri that is saved.

string $input_uri: The uri that the source provides.

File

tests/src/Unit/Feeds/Target/LinkTest.php, line 31

Class

LinkTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\Link @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testPrepareValue($expected_uri, $input_uri) {
  $method = $this
    ->getMethod(Link::class, 'prepareTarget')
    ->getClosure();
  $configuration = [
    'feed_type' => $this
      ->createMock(FeedTypeInterface::class),
    'target_definition' => $method($this
      ->getMockFieldDefinition()),
  ];
  $target = new Link($configuration, 'link', []);
  $method = $this
    ->getProtectedClosure($target, 'prepareValue');
  $values = [
    'uri' => $input_uri,
  ];
  $method(0, $values);
  $this
    ->assertSame($expected_uri, $values['uri']);
}