You are here

public function TestImporter::testLoadTarget in Feeds Paragraphs 8

@covers ::loadTarget

File

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

Class

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

Namespace

Drupal\Tests\feeds_para_mapper\Unit

Code

public function testLoadTarget() {
  $result = $this->importer
    ->loadTarget($this->node
    ->reveal(), $this->field);
  self::assertNotEmpty($result, "nested entities loaded");

  // Test with non-nested field:
  $info = $this->field
    ->get('target_info');
  $info->path = array(
    array(
      'bundle' => 'bundle_one',
      'host_field' => 'paragraph_field',
      'host_entity' => 'node',
      'order' => 0,
    ),
  );
  $this->field
    ->set('target_info', $info);
  $result = $this->importer
    ->loadTarget($this->node
    ->reveal(), $this->field);
  self::assertNotEmpty($result, "flat entity loaded");
}