You are here

public function FieldInstanceLabelDescriptionTranslationTest::providerSource in Drupal 10

Same name in this branch
  1. 10 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()
  2. 10 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldInstanceLabelDescriptionTranslationTest::providerSource()
Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()
  2. 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()

The data provider.

Return value

array Array of data sets to test, each of which is a numerically indexed array with the following elements:

  • An array of source data, which can be optionally processed and set up by subclasses.
  • An array of expected result rows.
  • (optional) The number of result rows the plugin under test is expected to return. If this is not a numeric value, the plugin will not be counted.
  • (optional) Array of configuration options for the plugin under test.

Overrides MigrateSourceTestBase::providerSource

See also

\Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::testSource

File

core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php, line 27

Class

FieldInstanceLabelDescriptionTranslationTest
Tests the field label and description translation source plugin.

Namespace

Drupal\Tests\field\Kernel\Plugin\migrate\source\d6

Code

public function providerSource() {
  $test = [];

  // The source data.
  $test[0]['source_data'] = [
    'i18n_strings' => [
      [
        'lid' => 10,
        'objectid' => 'story-field_test_two',
        'type' => 'field',
        'property' => 'widget_label',
      ],
      [
        'lid' => 11,
        'objectid' => 'story-field_test_two',
        'type' => 'field',
        'property' => 'widget_description',
      ],
      [
        'lid' => 12,
        'objectid' => 'story-field_test_two',
        'type' => 'field',
        'property' => 'widget_description',
      ],
    ],
    'locales_target' => [
      [
        'lid' => 10,
        'translation' => "fr - Integer Field",
        'language' => 'fr',
      ],
      [
        'lid' => 11,
        'translation' => 'fr - An example integer field.',
        'language' => 'fr',
      ],
    ],
  ];
  $test[0]['expected_results'] = [
    [
      'property' => 'widget_label',
      'translation' => "fr - Integer Field",
      'language' => 'fr',
      'lid' => '10',
    ],
    [
      'property' => 'widget_description',
      'translation' => 'fr - An example integer field.',
      'language' => 'fr',
      'lid' => '11',
    ],
  ];
  return $test;
}