public function FieldInstanceLabelDescriptionTranslationTest::providerSource in Drupal 10
Same name in this branch
- 10 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()
- 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
- 8 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldInstanceLabelDescriptionTranslationTest::providerSource()
- 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\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/ d7/ FieldInstanceLabelDescriptionTranslationTest.php, line 27
Class
- FieldInstanceLabelDescriptionTranslationTest
- Tests the field label and description translation source plugin.
Namespace
Drupal\Tests\field\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$test = [];
// The source data.
$test[0]['source_data'] = [
'i18n_string' => [
[
'lid' => 10,
'textgroup' => 'field',
'objectid' => 'story',
'type' => 'field_image',
'property' => 'label',
],
[
'lid' => 11,
'textgroup' => 'field',
'objectid' => 'story',
'type' => 'field_image',
'property' => 'description',
],
[
'lid' => 12,
'textgroup' => 'field',
'objectid' => 'forum',
'type' => 'taxonomy_forums',
'property' => 'label',
],
[
'lid' => 1,
'textgroup' => 'field',
'objectid' => 'story',
'type' => 'field_text',
'property' => 'label',
],
],
'locales_target' => [
[
'lid' => 10,
'translation' => 'fr - story label',
'language' => 'fr',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
[
'lid' => 11,
'translation' => 'fr - story description',
'language' => 'fr',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
[
'lid' => 12,
'translation' => 'zu - term reference',
'language' => 'zu',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
],
'field_config_instance' => [
[
'id' => '2',
'field_id' => '2',
'field_name' => 'field_image',
'entity_type' => 'node',
'bundle' => 'story',
'data' => 'a:0:{}',
'deleted' => '0',
],
[
'id' => '3',
'field_id' => '3',
'field_name' => 'field_image',
'entity_type' => 'node',
'bundle' => 'article',
'data' => 'a:0:{}',
'deleted' => '0',
],
[
'id' => '3',
'field_id' => '4',
'field_name' => 'field_term_reference',
'entity_type' => 'taxonomy_term',
'bundle' => 'trees',
'data' => 'a:0:{}',
'deleted' => '0',
],
],
];
$test[0]['expected_results'] = [
[
'property' => 'label',
'translation' => "fr - story label",
'language' => 'fr',
'lid' => '10',
],
[
'property' => 'description',
'translation' => 'fr - story description',
'language' => 'fr',
'lid' => '11',
],
[
'property' => 'label',
'translation' => 'zu - term reference',
'language' => 'zu',
'lid' => '12',
],
];
return $test;
}