You are here

protected function FeedsItemImportedFormatterTest::switchToCustomDateFormat in Feeds 8.3

Switch the date format to m-d-Y for testing.

1 call to FeedsItemImportedFormatterTest::switchToCustomDateFormat()
FeedsItemImportedFormatterTest::testFeedsItemImportedFormatter in tests/src/Functional/Plugin/Field/FieldFormatter/FeedsItemImportedFormatterTest.php
Test the feeds item imported formatter.

File

tests/src/Functional/Plugin/Field/FieldFormatter/FeedsItemImportedFormatterTest.php, line 32

Class

FeedsItemImportedFormatterTest
Tests feeds_item_imported field formatter.

Namespace

Drupal\Tests\feeds\Functional\Plugin\Field\FieldFormatter

Code

protected function switchToCustomDateFormat() {
  $settings = [
    'date_format' => 'custom',
    'custom_date_format' => 'm-d-Y',
  ];

  // Set display mode for feeds_item to feeds_item_imported on article content
  // type with custom date format.
  $this->container
    ->get('entity_display.repository')
    ->getViewDisplay('node', 'article', 'default')
    ->setComponent('feeds_item', [
    'type' => 'feeds_item_imported',
    'settings' => $settings,
    'weight' => 1,
  ])
    ->save();
}