function ProfileFieldOptionTranslationTest::providerSource

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldOptionTranslationTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\ProfileFieldOptionTranslationTest::providerSource()
  2. 8.9.x core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldOptionTranslationTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\ProfileFieldOptionTranslationTest::providerSource()
  3. 11.x core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldOptionTranslationTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\ProfileFieldOptionTranslationTest::providerSource()

Overrides ProfileFieldTest::providerSource

File

core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldOptionTranslationTest.php, line 27

Class

ProfileFieldOptionTranslationTest
Tests the field option translation source plugin.

Namespace

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

Code

public static function providerSource() {
    $test = parent::providerSource();
    // The source data.
    $test[0]['source_data']['i18n_strings'] = [
        [
            'lid' => 10,
            'objectid' => 'profile_color',
            'type' => 'field',
            'property' => 'options',
        ],
        [
            'lid' => 1,
            'objectid' => 'profile_last_name',
            'type' => 'field',
            'property' => 'options',
        ],
    ];
    $test[0]['source_data']['locales_target'] = [
        [
            'lid' => 10,
            'translation' => "fr - red\nfr - blue\nfr - green",
            'language' => 'fr',
        ],
    ];
    $test[0]['expected_data'] = [
        [
            'fid' => 4,
            'title' => 'Color',
            'name' => 'profile_color',
            'explanation' => 'A selection that allows user to select a color',
            'category' => 'profile',
            'page' => '',
            'type' => 'selection',
            'weight' => 0,
            'required' => 0,
            'register' => 0,
            'visibility' => 2,
            'autocomplete' => 0,
            'options' => [
                'red' => 'red',
                'blue' => 'blue',
                'green' => 'green',
                'yellow' => 'yellow',
            ],
            'property' => 'options',
            'objectid' => 'profile_color',
            'translation' => "fr - red\nfr - blue\nfr - green",
            'language' => 'fr',
        ],
    ];
    return $test;
}

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