function I18nProfileFieldTest::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

File

core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/I18nProfileFieldTest.php, line 24

Class

I18nProfileFieldTest
Tests the i18nProfileField source plugin.

Namespace

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

Code

public function providerSource() {
    $test = [];
    $test[0]['source_data'] = [
        'profile_fields' => [
            [
                'fid' => 42,
                'title' => 'I love migrations',
                'name' => 'profile_love_migrations',
            ],
        ],
        'i18n_strings' => [
            [
                'lid' => 10,
                'objectid' => 'profile_love_migrations',
                'type' => 'field',
                'property' => 'title',
            ],
            [
                'lid' => 11,
                'objectid' => 'profile_love_migrations',
                'type' => 'field',
                'property' => 'explanation',
            ],
        ],
        'locales_target' => [
            [
                'lid' => 10,
                'translation' => "J'aime les migrations.",
                'language' => 'fr',
            ],
            [
                'lid' => 11,
                'translation' => 'Si vous cochez cette case, vous aimez les migrations.',
                'language' => 'fr',
            ],
        ],
    ];
    $test[0]['expected_results'] = [
        [
            'property' => 'title',
            'translation' => "J'aime les migrations.",
            'language' => 'fr',
            'fid' => '42',
            'name' => 'profile_love_migrations',
        ],
        [
            'property' => 'explanation',
            'translation' => 'Si vous cochez cette case, vous aimez les migrations.',
            'language' => 'fr',
            'fid' => '42',
            'name' => 'profile_love_migrations',
        ],
    ];
    return $test;
}

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