You are here

public function TestImporter::testCreateParents in Feeds Paragraphs 8

@covers ::createParents

File

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

Class

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

Namespace

Drupal\Tests\feeds_para_mapper\Unit

Code

public function testCreateParents() {
  $this->entityHelper->values = array();
  $method = $this
    ->getMethod(Importer::class, 'createParents');
  $node = $this->node
    ->reveal();
  $expected = array(
    'type' => 'node',
    'entity' => $node,
    'bundle' => 'bundle_one',
    'field' => 'paragraph_field',
  );
  $result = $method
    ->invokeArgs($this->importer, array(
    $node,
  ));
  self::assertSame($expected, $result->host_info);

  // Test with already created parents:
  $result = $method
    ->invokeArgs($this->importer, array(
    $node,
  ));
  self::assertNull($result);
}