diff -u b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/I18nMenuLink.php b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/I18nMenuLink.php --- b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/I18nMenuLink.php +++ b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/I18nMenuLink.php @@ -10,6 +10,7 @@ * * @MigrateSource( * id = "d6_i18n_menu_link" + * source_provider = "i18n", * ) */ class I18nMenuLink extends DrupalSqlBase { diff -u b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateI18nMenuLinkTest.php b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateI18nMenuLinkTest.php --- b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateI18nMenuLinkTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateI18nMenuLinkTest.php @@ -34,7 +34,7 @@ ConfigurableLanguage::createFromLangcode('zu')->save(); $this->installSchema('system', ['router']); $this->installEntitySchema('menu_link_content'); - $this->executeMigrations(['menu', 'menu_links']); + $this->executeMigrations(['d6_menu', 'd6_menu_links']); $this->executeMigration('d6_i18n_menu_links'); } diff -u b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/I18nMenuLinkSourceTest.php b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/I18nMenuLinkSourceTest.php --- b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/I18nMenuLinkSourceTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/I18nMenuLinkSourceTest.php @@ -17,156 +17,149 @@ */ public static $modules = ['menu_link_content', 'migrate_drupal']; - protected $menu_links = [ - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 138, - 'plid' => 0, - 'link_path' => 'admin', - 'router_path' => 'admin', - 'link_title' => 'Test 1', - 'options' => ['attributes' => ['title' => 'Test menu link 1']], - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 1, - 'expanded' => 0, - 'weight' => 15, - 'depth' => 1, - 'customized' => 1, - 'p1' => '138', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - 'description' => 'Test menu link 1', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 139, - 'plid' => 138, - 'link_path' => 'admin/modules', - 'router_path' => 'admin/modules', - 'link_title' => 'Test 2', - 'options' => ['attributes' => ['title' => 'Test menu link 2']], - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 0, - 'expanded' => 0, - 'weight' => 12, - 'depth' => 2, - 'customized' => 1, - 'p1' => '138', - 'p2' => '139', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - 'description' => 'Test menu link 2', - ], - ]; - - protected $i18n_strings = [ - [ - 'lid' => 1, - 'objectid' => 139, - 'type' => 'item', - 'property' => 'title', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 2, - 'objectid' => 139, - 'type' => 'item', - 'property' => 'description', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 3, - 'objectid' => 138, - 'type' => 'item', - 'property' => 'description', - 'objectindex' => 0, - 'format' => 0, - ] - ]; - - protected $locales_target = [ - [ - 'lid' => 1, - 'language' => 'fr', - 'translation' => 'fr - title translation', - 'plid' => 0, - 'plural' => 0, - 'u18n_status' => 0, - ], - [ - 'lid' => 2, - 'language' => 'fr', - 'translation' => 'fr - description translation', - 'plid' => 0, - 'plural' => 0, - 'u18n_status' => 0, - ], - [ - 'lid' => 3, - 'language' => 'zu', - 'translation' => 'zu - description translation', - 'plid' => 0, - 'plural' => 0, - 'u18n_status' => 0, - ], - ]; - - protected $expectedResults = [ - [ - 'mlid' => 138, - 'link_path' => 'admin', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}}', - 'objectid' => 138, - 'language' => 'zu', - 'ltlid' => 3, - 'title' => 'Test 1', - 'description' => 'zu - description translation', - - ], - [ - 'mlid' => 139, - 'link_path' => 'admin/modules', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}', - 'objectid' => 139, - 'language' => 'fr', - 'ltlid' => 1, - 'title' => 'fr - title translation', - 'description' => 'fr - description translation', - ], - ]; - /** * {@inheritdoc} */ public function providerSource() { - $test[0][0]['menu_links'] = $this->menu_links; - $test[0][0]['i18n_strings'] = $this->i18n_strings; - $test[0][0]['locales_target'] = $this->locales_target; + $test = []; + $test[0]['source_data']['menu_links'] = [ + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 138, + 'plid' => 0, + 'link_path' => 'admin', + 'router_path' => 'admin', + 'link_title' => 'Test 1', + 'options' => ['attributes' => ['title' => 'Test menu link 1']], + 'module' => 'menu', + 'hidden' => 0, + 'external' => 0, + 'has_children' => 1, + 'expanded' => 0, + 'weight' => 15, + 'depth' => 1, + 'customized' => 1, + 'p1' => '138', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + 'description' => 'Test menu link 1', + ], + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 139, + 'plid' => 138, + 'link_path' => 'admin/modules', + 'router_path' => 'admin/modules', + 'link_title' => 'Test 2', + 'options' => ['attributes' => ['title' => 'Test menu link 2']], + 'module' => 'menu', + 'hidden' => 0, + 'external' => 0, + 'has_children' => 0, + 'expanded' => 0, + 'weight' => 12, + 'depth' => 2, + 'customized' => 1, + 'p1' => '138', + 'p2' => '139', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + 'description' => 'Test menu link 2', + ], + ]; + $test[0]['source_data']['i18n_strings'] = [ + [ + 'lid' => 1, + 'objectid' => 139, + 'type' => 'item', + 'property' => 'title', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 2, + 'objectid' => 139, + 'type' => 'item', + 'property' => 'description', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 3, + 'objectid' => 138, + 'type' => 'item', + 'property' => 'description', + 'objectindex' => 0, + 'format' => 0, + ] + ]; + $test[0]['source_data']['locales_target'] = [ + [ + 'lid' => 1, + 'language' => 'fr', + 'translation' => 'fr - title translation', + 'plid' => 0, + 'plural' => 0, + 'u18n_status' => 0, + ], + [ + 'lid' => 2, + 'language' => 'fr', + 'translation' => 'fr - description translation', + 'plid' => 0, + 'plural' => 0, + 'u18n_status' => 0, + ], + [ + 'lid' => 3, + 'language' => 'zu', + 'translation' => 'zu - description translation', + 'plid' => 0, + 'plural' => 0, + 'u18n_status' => 0, + ], + ]; - array_walk($test[0][0]['menu_links'], function (&$row) { + array_walk($test[0]['source_data']['menu_links'], function (&$row) { $row['options'] = serialize($row['options']); }); - $test[0][1] = $this->expectedResults; + $test[0]['expected_results'] = [ + [ + 'mlid' => 138, + 'link_path' => 'admin', + 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}}', + 'objectid' => 138, + 'language' => 'zu', + 'ltlid' => 3, + 'title' => 'Test 1', + 'description' => 'zu - description translation', + ], + [ + 'mlid' => 139, + 'link_path' => 'admin/modules', + 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}', + 'objectid' => 139, + 'language' => 'fr', + 'ltlid' => 1, + 'title' => 'fr - title translation', + 'description' => 'fr - description translation', + ], + ]; + return $test; }