reverted: --- b/core/modules/menu_link_content/tests/src/Unit/Plugin/migrate/source/d6/I18nMenuLinkSourceTest.php +++ /dev/null @@ -1,175 +0,0 @@ - 'id', - 'source' => [ - 'plugin' => 'test', - ], - ]; - - 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} - */ - protected function setUp() { - $this->databaseContents['menu_links'] = $this->menu_links; - $this->databaseContents['i18n_strings'] = $this->i18n_strings; - $this->databaseContents['locales_target'] = $this->locales_target; - - array_walk($this->databaseContents['menu_links'], function (&$row) { - $row['options'] = serialize($row['options']); - }); - - parent::setUp(); - } - -} only in patch2: unchanged: --- /dev/null +++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/I18nMenuLinkSourceTest.php @@ -0,0 +1,173 @@ + '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; + + array_walk($test[0][0]['menu_links'], function (&$row) { + $row['options'] = serialize($row['options']); + }); + + $test[0][1] = $this->expectedResults; + return $test; + } + +}