You are here

public function TestImporter::testCreateParagraphs in Feeds Paragraphs 8

@covers ::createParagraphs

File

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

Class

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

Namespace

Drupal\Tests\feeds_para_mapper\Unit

Code

public function testCreateParagraphs() {
  $this->entityHelper->values = array();
  $method = $this
    ->getMethod(Importer::class, 'createParagraphs');
  $values = array(
    array(
      'a',
    ),
    array(
      'b',
    ),
    array(
      'c',
    ),
  );
  $args = array(
    $this->node
      ->reveal(),
    $values,
  );
  $result = $method
    ->invokeArgs($this->importer, $args);
  self::assertCount(3, $result);
  for ($i = 0; $i < count($result); $i++) {
    self::assertArrayEquals($values[$i], $result[$i]['value']);
    self::assertInstanceOf(Paragraph::class, $result[$i]['paragraph']);
  }
}