You are here

protected function FieldTest::setUp in Feeds 8.3

Overrides FeedsKernelTestBase::setUp

File

tests/src/Kernel/Feeds/Target/FieldTest.php, line 26

Class

FieldTest
Tests for mapping to text and numeric fields.

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Target

Code

protected function setUp() {
  parent::setUp();

  // Add fields.
  $this
    ->setUpBodyField();
  $this
    ->createFieldWithStorage('field_alpha');
  $this
    ->createFieldWithStorage('field_beta', [
    'type' => 'integer',
  ]);
  $this
    ->createFieldWithStorage('field_gamma', [
    'type' => 'decimal',
  ]);
  $this
    ->createFieldWithStorage('field_delta', [
    'type' => 'float',
  ]);

  // Create and configure feed type.
  $this->feedType = $this
    ->createFeedTypeForCsv([
    'title' => 'title',
    'body' => 'body',
    'alpha' => 'alpha',
    'beta' => 'beta',
    'gamma' => 'gamma',
    'delta' => 'delta',
  ], [
    'mappings' => [
      [
        'target' => 'title',
        'map' => [
          'value' => 'title',
        ],
      ],
      [
        'target' => 'body',
        'map' => [
          'value' => 'body',
        ],
        'settings' => [
          'format' => 'plain_text',
        ],
      ],
      [
        'target' => 'field_alpha',
        'map' => [
          'value' => 'alpha',
        ],
      ],
      [
        'target' => 'field_beta',
        'map' => [
          'value' => 'beta',
        ],
      ],
      [
        'target' => 'field_gamma',
        'map' => [
          'value' => 'gamma',
        ],
      ],
      [
        'target' => 'field_delta',
        'map' => [
          'value' => 'delta',
        ],
      ],
    ],
  ]);
}