function FieldInstanceLabelDescriptionTranslationTest::providerSource

Same name in this branch
  1. 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()
Same name in other branches
  1. 8.9.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()
  2. 8.9.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldInstanceLabelDescriptionTranslationTest::providerSource()
  3. 10 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()
  4. 10 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldInstanceLabelDescriptionTranslationTest::providerSource()
  5. 11.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstanceLabelDescriptionTranslationTest::providerSource()
  6. 11.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldInstanceLabelDescriptionTranslationTest::providerSource()

Overrides MigrateSourceTestBase::providerSource

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\d7

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.