You are here

protected function TranslationTest::getMappingsInLanguage in Feeds 8.3

Creates mappings for each field in a specified language.

Parameters

string $langcode: The code of the desired language.

string $source_suffix: (optional) The suffix to add to the mapping sources.

Return value

array A list of mappings.

9 calls to TranslationTest::getMappingsInLanguage()
TranslationTest::testAutocreatedTermLanguage in tests/src/Kernel/Feeds/Target/TranslationTest.php
Tests if auto-created terms are imported in the configured language.
TranslationTest::testClearOutValues in tests/src/Kernel/Feeds/Target/TranslationTest.php
Tests if values are cleared out when importing empty values.
TranslationTest::testImportInProcessorConfiguredLanguage in tests/src/Kernel/Feeds/Target/TranslationTest.php
Tests that the language setting on the processor is respected.
TranslationTest::testImportNonDefaultLanguage in tests/src/Kernel/Feeds/Target/TranslationTest.php
Tests importing only in a language that is not the default language.
TranslationTest::testImportTranslationForExistingNode in tests/src/Kernel/Feeds/Target/TranslationTest.php
Tests importing a translation for an existing node.

... See full list

File

tests/src/Kernel/Feeds/Target/TranslationTest.php, line 539

Class

TranslationTest
Test for the entity field translation.

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Target

Code

protected function getMappingsInLanguage($langcode, $source_suffix = '') {
  return [
    [
      'target' => 'title',
      'map' => [
        'value' => 'title' . $source_suffix,
      ],
      'settings' => [
        'language' => $langcode,
      ],
    ],
    [
      'target' => 'field_alpha',
      'map' => [
        'value' => 'body' . $source_suffix,
      ],
      'settings' => [
        'language' => $langcode,
      ],
    ],
    [
      'target' => 'field_tags',
      'map' => [
        'target_id' => 'terms' . $source_suffix,
      ],
      'settings' => [
        'reference_by' => 'name',
        'language' => $langcode,
        'autocreate' => 1,
      ],
    ],
  ];
}