You are here

public function TestImporter::testSetValue in Feeds Paragraphs 8

@covers ::setValue

File

tests/src/Unit/TestImporter.php, line 128

Class

TestImporter
@group Feeds Paragraphs @coversDefaultClass \Drupal\feeds_para_mapper\Importer

Namespace

Drupal\Tests\feeds_para_mapper\Unit

Code

public function testSetValue() {
  $this->entityHelper->values = array();
  $method = $this
    ->getMethod(Importer::class, 'setValue');
  $paragraph = end($this->entityHelper->paragraphs);
  $value = array(
    'value' => "a",
  );
  $args = array(
    $paragraph
      ->reveal(),
    $value,
  );
  $method
    ->invokeArgs($this->importer, $args);
  $this->instanceMock
    ->setTarget(Argument::type(FeedInterface::class), Argument::type(Paragraph::class), Argument::type('string'), Argument::type('array'))
    ->shouldHaveBeenCalled();
  $appendedValue = $this->entityHelper->values['bundle_two_text'];
  self::assertSame($value, $appendedValue, "The value has been set");
}