You are here

public function TemporaryTest::testTwoTemporaryTarget in Feeds 8.3

Basic test import with two temporary targets.

File

tests/src/Kernel/Feeds/Target/TemporaryTest.php, line 60

Class

TemporaryTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\Temporary @group feeds

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Target

Code

public function testTwoTemporaryTarget() {

  // Set the mapping to add two temporary targets.
  $this->feedType
    ->setMappings([
    [
      'target' => 'title',
      'map' => [
        'value' => 'title',
      ],
    ],
    [
      'target' => 'temporary_target',
      'map' => [
        'value' => 'alpha',
      ],
    ],
    [
      'target' => 'temporary_target',
      'map' => [
        'value' => 'beta',
      ],
    ],
  ]);

  // Import CSV file.
  $feed = $this
    ->createFeed($this->feedType
    ->id(), [
    'source' => $this
      ->resourcesPath() . '/csv/content.csv',
  ]);
  $feed
    ->import();
  $this
    ->assertNodeCount(2);
}