function MenuTranslationTest::providerSource

Same name in other branches
  1. 10 core/modules/system/tests/src/Kernel/Plugin/migrate/source/d7/MenuTranslationTest.php \Drupal\Tests\system\Kernel\Plugin\migrate\source\d7\MenuTranslationTest::providerSource()
  2. 11.x core/modules/system/tests/src/Kernel/Plugin/migrate/source/d7/MenuTranslationTest.php \Drupal\Tests\system\Kernel\Plugin\migrate\source\d7\MenuTranslationTest::providerSource()

Overrides MigrateSourceTestBase::providerSource

File

core/modules/system/tests/src/Kernel/Plugin/migrate/source/d7/MenuTranslationTest.php, line 23

Class

MenuTranslationTest
Tests the menu translation source plugin.

Namespace

Drupal\Tests\system\Kernel\Plugin\migrate\source\d7

Code

public function providerSource() {
    $tests = [];
    $tests[0]['source_data']['menu_custom'] = [
        [
            'menu_name' => 'navigation',
            'title' => 'Navigation',
            'description' => 'Navigation description',
            'language' => 'und',
            'i18n_mode' => 0,
        ],
        [
            'menu_name' => 'menu-name-2',
            'title' => 'menu custom value 2',
            'description' => 'menu custom description value 2',
            'language' => 'und',
            'i18n_mode' => 0,
        ],
    ];
    $tests[0]['source_data']['i18n_string'] = [
        [
            'lid' => 1,
            'textgroup' => 'menu',
            'context' => ' menu:navigation:description',
            'objectid' => 'navigation',
            'type' => 'menu',
            'property' => 'description',
            'objectindex' => 0,
            'format' => '',
        ],
        [
            'lid' => 2,
            'textgroup' => 'menu',
            'context' => ' menu:navigation:title',
            'objectid' => 'navigation',
            'type' => 'menu',
            'property' => 'title',
            'objectindex' => 0,
            'format' => '',
        ],
    ];
    $tests[0]['source_data']['locales_target'] = [
        [
            'lid' => 1,
            'translation' => 'navigation description translation',
            'language' => 'fr',
            'plid' => 0,
            'plural' => 0,
            'i18n_status' => 0,
        ],
        [
            'lid' => 2,
            'translation' => 'navigation translation',
            'language' => 'fr',
            'plid' => 0,
            'plural' => 0,
            'i18n_status' => 0,
        ],
    ];
    $tests[0]['expected_results'] = [
        [
            'menu_name' => 'navigation',
            'type' => 'menu',
            'property' => 'description',
            'translation' => 'navigation description translation',
            'language' => 'fr',
            'objectid' => 'navigation',
        ],
        [
            'menu_name' => 'navigation',
            'type' => 'menu',
            'property' => 'title',
            'translation' => 'navigation translation',
            'language' => 'fr',
            'objectid' => 'navigation',
        ],
    ];
    return $tests;
}

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