You are here

protected function FieldTest::setUpFieldDisplay in Feeds 8.3

Configures display of fields.

1 call to FieldTest::setUpFieldDisplay()
FieldTest::testClearOutValues in tests/src/Kernel/Feeds/Target/FieldTest.php
Tests if values are cleared out when an empty value is provided.

File

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

Class

FieldTest
Tests for mapping to text and numeric fields.

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Target

Code

protected function setUpFieldDisplay() {
  $this
    ->installConfig([
    'system',
  ]);
  $formats = $this->container
    ->get('entity_type.manager')
    ->getStorage('date_format')
    ->loadMultiple([
    'long',
    'medium',
    'short',
  ]);
  $formats['long']
    ->setPattern('l, j. F Y - G:i')
    ->save();
  $formats['medium']
    ->setPattern('j. F Y - G:i')
    ->save();
  $formats['short']
    ->setPattern('Y M j - g:ia')
    ->save();
  $this->container
    ->get('entity_display.repository')
    ->getViewDisplay('node', 'article', 'default')
    ->setComponent('field_alpha', [
    'type' => 'text_default',
    'label' => 'above',
  ])
    ->setComponent('field_beta', [
    'type' => 'number_integer',
    'label' => 'above',
  ])
    ->setComponent('field_gamma', [
    'type' => 'number_decimal',
    'label' => 'above',
  ])
    ->setComponent('field_delta', [
    'type' => 'number_decimal',
    'label' => 'above',
  ])
    ->save();
}