From b61e2a65fc44b2b33a668fae7cfdbf8a2f6fe95b Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 10 Apr 2018 14:13:48 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"Issue=20#2225587=20by=20quietone,=20J?= =?UTF-8?q?o=20Fitzgerald,=20heddn,=20Pavan=20B=20S,=20maxocub,=20phenapro?= =?UTF-8?q?xima,=20G=C3=A1bor=20Hojtsy,=20ao2,=20alexpott:=20Migrate=20D6?= =?UTF-8?q?=20i18n=20menu=20links"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 66480d7f4034b0a048bf03b36af515076a15589d. --- .../d6_language_content_menu_settings.yml | 21 -- ...MigrateLanguageContentMenuSettingsTest.php | 68 ----- .../migrations/d6_menu_links_translation.yml | 54 ---- .../migrate/source/d6/MenuLinkTranslation.php | 97 ------- .../Kernel/Migrate/d6/MigrateMenuLinkTest.php | 5 +- .../d6/MigrateMenuLinkTranslationTest.php | 93 ------- .../source/d6/MenuLinkTranslationTest.php | 250 ------------------ .../migrate/src/Plugin/migrate/id_map/Sql.php | 13 +- .../tests/src/Unit/MigrateSqlIdMapTest.php | 6 +- .../migrate_drupal/tests/fixtures/drupal6.php | 89 +------ .../d6/MigrateUpgrade6ReviewPageTest.php | 2 +- .../src/Functional/d6/MigrateUpgrade6Test.php | 8 +- .../src/Plugin/migrate/source/Extension.php | 66 ----- .../Plugin/migrate/source/ExtensionTest.php | 77 ------ 14 files changed, 13 insertions(+), 836 deletions(-) delete mode 100644 core/modules/language/migrations/d6_language_content_menu_settings.yml delete mode 100644 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php delete mode 100644 core/modules/menu_link_content/migrations/d6_menu_links_translation.yml delete mode 100644 core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php delete mode 100644 core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTranslationTest.php delete mode 100644 core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php delete mode 100644 core/modules/system/src/Plugin/migrate/source/Extension.php delete mode 100644 core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php diff --git a/core/modules/language/migrations/d6_language_content_menu_settings.yml b/core/modules/language/migrations/d6_language_content_menu_settings.yml deleted file mode 100644 index 8e015f21829..00000000000 --- a/core/modules/language/migrations/d6_language_content_menu_settings.yml +++ /dev/null @@ -1,21 +0,0 @@ -id: d6_language_content_menu_settings -label: Drupal 6 language content menu settings -migration_tags: - - Drupal 6 - - Configuration -source: - plugin: extension - name: i18nmenu - constants: - target_type: 'menu_link_content' - langcode: 'site_default' -process: - target_entity_type_id: 'constants/target_type' - # menu_link_content has a bundle key but no bundle support so use the entity - # type as the bundle. - target_bundle: 'constants/target_type' - default_langcode: 'constants/langcode' - # Drupal 6 menus are translated when the i18nmenu module is enabled. - language_alterable: status -destination: - plugin: entity:language_content_settings diff --git a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php deleted file mode 100644 index 0148452dc97..00000000000 --- a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php +++ /dev/null @@ -1,68 +0,0 @@ -save(); - ConfigurableLanguage::createFromLangcode('fr')->save(); - $this->executeMigrations(['d6_language_content_menu_settings']); - } - - /** - * Tests migration of menu translation ability. - */ - public function testLanguageMenuContent() { - $config = ContentLanguageSettings::load('menu_link_content.menu_link_content'); - $this->assertInstanceOf(ContentLanguageSettings::class, $config); - $this->assertSame('menu_link_content', $config->getTargetEntityTypeId()); - $this->assertSame('menu_link_content', $config->getTargetBundle()); - $this->assertSame(LanguageInterface::LANGCODE_SITE_DEFAULT, $config->getDefaultLangcode()); - $this->assertTrue($config->isLanguageAlterable()); - - // Test that menus are not alterable when the i18nmenu is not enabled. - $this->sourceDatabase->update('system') - ->fields(['status' => 0]) - ->condition('name', 'i18nmenu') - ->execute(); - - /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */ - $migration = $this->getMigration('d6_language_content_menu_settings'); - // Indicate we're rerunning a migration that's already run. - $migration->getIdMap()->prepareUpdate(); - $this->executeMigration($migration); - - $config = ContentLanguageSettings::load('menu_link_content.menu_link_content'); - $this->assertInstanceOf(ContentLanguageSettings::class, $config); - $this->assertSame('menu_link_content', $config->getTargetEntityTypeId()); - $this->assertSame('menu_link_content', $config->getTargetBundle()); - $this->assertSame(LanguageInterface::LANGCODE_SITE_DEFAULT, $config->getDefaultLangcode()); - $this->assertFalse($config->isLanguageAlterable()); - } - -} diff --git a/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml b/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml deleted file mode 100644 index 71e55992e8a..00000000000 --- a/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml +++ /dev/null @@ -1,54 +0,0 @@ -id: d6_menu_links_translation -label: Menu links -migration_tags: - - Drupal 6 - - Content -source: - plugin: d6_menu_link_translation -process: - id: mlid - langcode: language - title: - - - plugin: callback - source: - - title_translated - - link_title - callable: array_filter - - - plugin: callback - callable: current - description: - - - plugin: callback - source: - - description_translated - - description - callable: array_filter - - - plugin: callback - callable: current - menu_name: - - - plugin: migration_lookup - # The menu migration is in the system module. - migration: d6_menu - source: menu_name - - - plugin: skip_on_empty - method: row - - - plugin: static_map - map: - management: admin - bypass: true -destination: - plugin: entity:menu_link_content - default_bundle: menu_link_content - no_stub: true - translations: true -migration_dependencies: - required: - - language - - d6_menu - - d6_menu_links diff --git a/core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php deleted file mode 100644 index dbc455b3532..00000000000 --- a/core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php +++ /dev/null @@ -1,97 +0,0 @@ -leftJoin('i18n_strings', 'i18n', 'ml.mlid = i18n.objectid'); - $query->isNotNull('i18n.lid'); - $query->addField('i18n', 'lid'); - $query->addField('i18n', 'property'); - - // Add in the translation for the property. - $query->innerJoin('locales_target', 'lt', 'i18n.lid = lt.lid'); - $query->addField('lt', 'language'); - $query->addField('lt', 'translation'); - return $query; - } - - /** - * {@inheritdoc} - */ - public function prepareRow(Row $row) { - $language = $row->getSourceProperty('language'); - $mlid = $row->getSourceProperty('mlid'); - - // If this row has been migrated it is a duplicate then skip it. - if ($this->idMap->lookupDestinationIds(['mlid' => $mlid, 'language' => $language])) { - return FALSE; - } - - // Save the translation for this property. - $property = $row->getSourceProperty('property'); - $row->setSourceProperty($property . '_translated', $row->getSourceProperty('translation')); - - // Get the translation, if one exists, for the property not already in the - // row. - $other_property = ($property == 'title') ? 'description' : 'title'; - $query = $this->select('i18n_strings', 'i18n') - ->fields('i18n', ['lid']) - ->condition('i18n.property', $other_property) - ->condition('i18n.objectid', $mlid); - $query->leftJoin('locales_target', 'lt', 'i18n.lid = lt.lid'); - $query->condition('lt.language', $language); - $query->addField('lt', 'translation'); - $results = $query->execute()->fetchAssoc(); - $row->setSourceProperty($other_property . '_translated', $results['translation']); - parent::prepareRow($row); - } - - /** - * {@inheritdoc} - */ - public function fields() { - $fields = [ - 'language' => $this->t('Language for this menu.'), - 'title_translated' => $this->t('Menu link title translation.'), - 'description_translated' => $this->t('Menu link description translation.'), - ]; - return parent::fields() + $fields; - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['language']['type'] = 'string'; - return parent::getIds() + $ids; - } - -} diff --git a/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php index 36e4f30dc0a..7c7b57fbabb 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php @@ -84,7 +84,7 @@ class MigrateMenuLinkTest extends MigrateNodeTestBase { * Tests migration of menu links. */ public function testMenuLinks() { - $this->assertEntity('138', 'Test 1', 'secondary-links', 'Test menu link 1', TRUE, FALSE, ['attributes' => ['title' => 'Test menu link 1'], 'langcode' => 'en'], 'internal:/user/login', -50); + $this->assertEntity('138', 'Test 1', 'secondary-links', 'Test menu link 1', TRUE, FALSE, ['attributes' => ['title' => 'Test menu link 1']], 'internal:/user/login', -50); $this->assertEntity('139', 'Test 2', 'secondary-links', 'Test menu link 2', TRUE, TRUE, ['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']], 'internal:/admin', -49); $this->assertEntity('140', 'Drupal.org', 'secondary-links', NULL, TRUE, FALSE, ['attributes' => ['title' => '']], 'https://www.drupal.org', -50); @@ -96,9 +96,6 @@ class MigrateMenuLinkTest extends MigrateNodeTestBase { $this->assertEntity('460', 'Le Vrai McCoy', 'primary-links', NULL, TRUE, FALSE, ['attributes' => ['title' => ''], 'alter' => TRUE], 'entity:node/10', 0); $this->assertEntity('461', 'Abantu zulu', 'primary-links', NULL, TRUE, FALSE, ['attributes' => ['title' => ''], 'alter' => TRUE], 'entity:node/12', 0); $this->assertEntity('462', 'The Zulu People', 'primary-links', NULL, TRUE, FALSE, ['attributes' => ['title' => ''], 'alter' => TRUE], 'entity:node/12', 0); - - // Test the migration of menu links translation. - $this->assertEntity('463', 'fr - Test 1', 'secondary-links', 'fr - Test menu link 1', TRUE, FALSE, ['attributes' => ['title' => 'fr - Test menu link 1'], 'langcode' => 'fr', 'alter' => TRUE], 'internal:/user/login', -49); } } diff --git a/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTranslationTest.php b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTranslationTest.php deleted file mode 100644 index 21911f06f41..00000000000 --- a/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTranslationTest.php +++ /dev/null @@ -1,93 +0,0 @@ -migrateContent(); - $this->installSchema('system', ['router']); - $this->installEntitySchema('menu_link_content'); - $this->executeMigrations([ - 'language', - 'd6_menu', - 'd6_menu_links', - 'd6_menu_links_translation', - ]); - } - - /** - * Tests migration of menu links. - */ - public function testMenuLinks() { - /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link */ - $menu_link = MenuLinkContent::load(139)->getTranslation('fr'); - $this->assertInstanceOf(MenuLinkContent::class, $menu_link); - $this->assertSame('fr - Test 2', $menu_link->getTitle()); - $this->assertSame('fr - Test menu link 2', $menu_link->getDescription()); - $this->assertSame('secondary-links', $menu_link->getMenuName()); - $this->assertTrue($menu_link->isEnabled()); - $this->assertTrue($menu_link->isExpanded()); - $this->assertSame(['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']], $menu_link->link->options); - $this->assertSame('internal:/admin', $menu_link->link->uri); - $this->assertSame(-49, $menu_link->getWeight()); - - $menu_link = MenuLinkContent::load(139)->getTranslation('zu'); - $this->assertInstanceOf(MenuLinkContent::class, $menu_link); - $this->assertSame('Test 2', $menu_link->getTitle()); - $this->assertSame('zu - Test menu link 2', $menu_link->getDescription()); - $this->assertSame('secondary-links', $menu_link->getMenuName()); - $this->assertTrue($menu_link->isEnabled()); - $this->assertTrue($menu_link->isExpanded()); - $this->assertSame(['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']], $menu_link->link->options); - $this->assertSame('internal:/admin', $menu_link->link->uri); - $this->assertSame(-49, $menu_link->getWeight()); - - $menu_link = MenuLinkContent::load(140)->getTranslation('fr'); - $this->assertInstanceOf(MenuLinkContent::class, $menu_link); - $this->assertSame('fr - Drupal.org', $menu_link->getTitle()); - $this->assertSame('', $menu_link->getDescription()); - $this->assertSame('secondary-links', $menu_link->getMenuName()); - $this->assertTrue($menu_link->isEnabled()); - $this->assertFalse($menu_link->isExpanded()); - $this->assertSame(['attributes' => ['title' => '']], $menu_link->link->options); - $this->assertSame('https://www.drupal.org', $menu_link->link->uri); - $this->assertSame(-50, $menu_link->getWeight()); - - $menu_link = MenuLinkContent::load(463); - $this->assertInstanceOf(MenuLinkContent::class, $menu_link); - $this->assertSame('fr - Test 1', $menu_link->getTitle()); - $this->assertSame('fr - Test menu link 1', $menu_link->getDescription()); - $this->assertSame('secondary-links', $menu_link->getMenuName()); - $this->assertTrue($menu_link->isEnabled()); - $this->assertFalse($menu_link->isExpanded()); - $attributes = [ - 'attributes' => [ - 'title' => 'fr - Test menu link 1', - ], - 'langcode' => 'fr', - 'alter' => TRUE, - ]; - $this->assertSame($attributes, $menu_link->link->options); - $this->assertSame('internal:/user/login', $menu_link->link->uri); - $this->assertSame(-49, $menu_link->getWeight()); - } - -} diff --git a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php deleted file mode 100644 index d373bb25873..00000000000 --- a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php +++ /dev/null @@ -1,250 +0,0 @@ - 'menu-test-menu', - 'mlid' => 138, - 'plid' => 0, - 'link_path' => 'admin', - 'router_path' => 'admin', - 'link_title' => 'Test 1', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"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', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 139, - 'plid' => 138, - 'link_path' => 'admin/modules', - 'router_path' => 'admin/modules', - 'link_title' => 'Test 2', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"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', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 140, - 'plid' => 0, - 'link_path' => 'https://www.drupal.org', - 'router_path' => 'admin/modules', - 'link_title' => 'Test 2', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}', - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 0, - 'expanded' => 0, - 'weight' => 12, - 'depth' => 2, - 'customized' => 1, - 'p1' => '0', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 141, - 'plid' => 0, - 'link_path' => 'https://api.drupal.org/api/drupal/8.3.x', - 'router_path' => 'admin/modules', - 'link_title' => 'Test 3', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 3";}}', - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 0, - 'expanded' => 0, - 'weight' => 12, - 'depth' => 2, - 'customized' => 1, - 'p1' => '0', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - ], - ]; - $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' => 140, - 'type' => 'item', - 'property' => 'description', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 4, - 'objectid' => 141, - 'type' => 'item', - 'property' => 'title', - 'objectindex' => 0, - 'format' => 0, - ], - ]; - $test[0]['source_data']['locales_target'] = [ - [ - 'lid' => 1, - 'language' => 'fr', - 'translation' => 'fr - title translation', - 'plid' => 0, - 'plural' => 0, - 'i18n_status' => 0, - ], - [ - 'lid' => 2, - 'language' => 'fr', - 'translation' => 'fr - description translation', - 'plid' => 0, - 'plural' => 0, - 'i18n_status' => 0, - ], - [ - 'lid' => 3, - 'language' => 'zu', - 'translation' => 'zu - description translation', - 'plid' => 0, - 'plural' => 0, - 'i18n_status' => 0, - ], - [ - 'lid' => 4, - 'language' => 'zu', - 'translation' => 'zu - title translation', - 'plid' => 0, - 'plural' => 0, - 'i18n_status' => 0, - ], - ]; - - $test[0]['expected_results'] = [ - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 139, - 'property' => 'title', - 'language' => 'fr', - 'link_title' => 'Test 2', - 'description' => 'Test menu link 2', - 'title_translated' => 'fr - title translation', - 'description_translated' => 'fr - description translation', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 139, - 'property' => 'description', - 'language' => 'fr', - 'link_title' => 'Test 2', - 'description' => 'Test menu link 2', - 'title_translated' => 'fr - title translation', - 'description_translated' => 'fr - description translation', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 140, - 'property' => 'description', - 'language' => 'zu', - 'link_title' => 'Test 2', - 'description' => 'Test menu link 2', - 'title_translated' => NULL, - 'description_translated' => 'zu - description translation', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 141, - 'property' => 'title', - 'language' => 'zu', - 'link_title' => 'Test 3', - 'description' => 'Test menu link 3', - 'title_translated' => 'zu - title translation', - 'description_translated' => NULL, - ], - ]; - - return $test; - } - -} diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php index 946b208a101..a69e31cba9d 100644 --- a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php +++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php @@ -563,13 +563,9 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP $conditions = []; foreach ($this->sourceIdFields() as $field_name => $db_field) { if ($is_associative) { - // Ensure to handle array elements with a NULL value. - if (array_key_exists($field_name, $source_id_values)) { - // Associative $source_id_values can have fields out of order. - if (isset($source_id_values[$field_name])) { - // Only add a condition if the value is not NULL. - $conditions[$db_field] = $source_id_values[$field_name]; - } + // Associative $source_id_values can have fields out of order. + if (isset($source_id_values[$field_name])) { + $conditions[$db_field] = $source_id_values[$field_name]; unset($source_id_values[$field_name]); } } @@ -584,8 +580,7 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP } if (!empty($source_id_values)) { - $var_dump = var_export($source_id_values, TRUE); - throw new MigrateException(sprintf("Extra unknown items in source IDs: %s", $var_dump)); + throw new MigrateException("Extra unknown items in source IDs"); } $query = $this->getDatabase()->select($this->mapTableName(), 'map') diff --git a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php index 001e14c74c8..bc849916d7e 100644 --- a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php +++ b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php @@ -517,8 +517,6 @@ class MigrateSqlIdMapTest extends MigrateTestCase { $this->assertEquals([[101, 'en'], [101, 'fr'], [101, 'de']], $id_map->lookupDestinationIds(['nid' => 1])); $this->assertEquals([[102, 'en']], $id_map->lookupDestinationIds(['nid' => 2])); $this->assertEquals([], $id_map->lookupDestinationIds(['nid' => 99])); - $this->assertEquals([[101, 'en'], [101, 'fr'], [101, 'de']], $id_map->lookupDestinationIds(['nid' => 1, 'language' => NULL])); - $this->assertEquals([[102, 'en']], $id_map->lookupDestinationIds(['nid' => 2, 'language' => NULL])); // Out-of-order partial associative list. $this->assertEquals([[101, 'en'], [102, 'en']], $id_map->lookupDestinationIds(['language' => 'en'])); $this->assertEquals([[101, 'fr']], $id_map->lookupDestinationIds(['language' => 'fr'])); @@ -529,14 +527,14 @@ class MigrateSqlIdMapTest extends MigrateTestCase { $this->fail('Too many source IDs should throw'); } catch (MigrateException $e) { - $this->assertEquals("Extra unknown items in source IDs: array (\n 0 => 3,\n)", $e->getMessage()); + $this->assertEquals("Extra unknown items in source IDs", $e->getMessage()); } try { $id_map->lookupDestinationIds(['nid' => 1, 'aaa' => '2']); $this->fail('Unknown source ID key should throw'); } catch (MigrateException $e) { - $this->assertEquals("Extra unknown items in source IDs: array (\n 'aaa' => '2',\n)", $e->getMessage()); + $this->assertEquals("Extra unknown items in source IDs", $e->getMessage()); } // Verify that we are looking up by source_id_hash when all source IDs are diff --git a/core/modules/migrate_drupal/tests/fixtures/drupal6.php b/core/modules/migrate_drupal/tests/fixtures/drupal6.php index 4d4e18be489..ea4eee69b2a 100644 --- a/core/modules/migrate_drupal/tests/fixtures/drupal6.php +++ b/core/modules/migrate_drupal/tests/fixtures/drupal6.php @@ -9710,38 +9710,6 @@ $connection->insert('i18n_strings') 'objectindex' => '7', 'format' => '0', )) -->values(array( - 'lid' => '1674', - 'objectid' => '463', - 'type' => 'item', - 'property' => 'title', - 'objectindex' => '463', - 'format' => '0', -)) -->values(array( - 'lid' => '1675', - 'objectid' => '463', - 'type' => 'item', - 'property' => 'description', - 'objectindex' => '463', - 'format' => '0', -)) -->values(array( - 'lid' => '1676', - 'objectid' => '138', - 'type' => 'item', - 'property' => 'title', - 'objectindex' => '138', - 'format' => '0', -)) -->values(array( - 'lid' => '1677', - 'objectid' => '138', - 'type' => 'item', - 'property' => 'description', - 'objectindex' => '138', - 'format' => '0', -)) ->execute(); $connection->schema()->createTable('i18n_variable', array( @@ -22208,34 +22176,6 @@ $connection->insert('locales_source') 'source' => 'Forums', 'version' => '1', )) -->values(array( - 'lid' => '1674', - 'location' => 'item:463:title', - 'textgroup' => 'menu', - 'source' => 'fr - Test 1', - 'version' => '1', -)) -->values(array( - 'lid' => '1675', - 'location' => 'item:463:description', - 'textgroup' => 'menu', - 'source' => 'fr - Test menu link 1', - 'version' => '1', -)) -->values(array( - 'lid' => '1676', - 'location' => 'item:138:title', - 'textgroup' => 'menu', - 'source' => 'Test 1', - 'version' => '1', -)) -->values(array( - 'lid' => '1677', - 'location' => 'item:138:description', - 'textgroup' => 'menu', - 'source' => 'Test menu link 1', - 'version' => '1', -)) ->execute(); $connection->schema()->createTable('locales_target', array( @@ -27765,7 +27705,7 @@ $connection->insert('menu_links') 'link_path' => 'user/login', 'router_path' => 'user/login', 'link_title' => 'Test 1', - 'options' => 'a:2:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}s:8:"langcode";s:2:"en";}', + 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}}', 'module' => 'menu', 'hidden' => '0', 'external' => '0', @@ -33887,33 +33827,6 @@ $connection->insert('menu_links') 'p9' => '0', 'updated' => '0', )) -->values(array( - 'menu_name' => 'secondary-links', - 'mlid' => '463', - 'plid' => '139', - 'link_path' => 'user/login', - 'router_path' => 'user/login', - 'link_title' => 'fr - Test 1', - 'options' => 'a:3:{s:10:"attributes";a:1:{s:5:"title";s:21:"fr - Test menu link 1";}s:8:"langcode";s:2:"fr";s:5:"alter";b:1;}', - 'module' => 'menu', - 'hidden' => '0', - 'external' => '0', - 'has_children' => '0', - 'expanded' => '0', - 'weight' => '-49', - 'depth' => '2', - 'customized' => '1', - 'p1' => '139', - 'p2' => '459', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', -)) ->execute(); $connection->schema()->createTable('menu_router', array( diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php index 798f0290d84..a526de77e95 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php @@ -89,7 +89,6 @@ class MigrateUpgrade6ReviewPageTest extends MigrateUpgradeReviewPageTestBase { 'filefield_meta', 'help', 'i18n', - 'i18nmenu', 'i18nstrings', 'imageapi', 'imageapi_gd', @@ -124,6 +123,7 @@ class MigrateUpgrade6ReviewPageTest extends MigrateUpgradeReviewPageTestBase { 'i18nblocks', 'i18ncck', 'i18ncontent', + 'i18nmenu', 'i18npoll', 'i18nprofile', 'i18nsync', diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php index f32e60a6105..841b27c310e 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php @@ -68,7 +68,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { 'file' => 8, 'filter_format' => 7, 'image_style' => 5, - 'language_content_settings' => 3, + 'language_content_settings' => 2, 'migration' => 105, 'node' => 17, // The 'book' module provides the 'book' node type, and the migration @@ -85,7 +85,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { 'tour' => 4, 'user' => 7, 'user_role' => 6, - 'menu_link_content' => 10, + 'menu_link_content' => 9, 'view' => 16, 'date_format' => 11, 'entity_form_display' => 29, @@ -106,7 +106,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { $counts['entity_view_display'] = 53; $counts['entity_view_mode'] = 14; $counts['file'] = 9; - $counts['menu_link_content'] = 11; + $counts['menu_link_content'] = 10; $counts['node'] = 18; $counts['taxonomy_term'] = 9; $counts['user'] = 8; @@ -131,7 +131,6 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { 'filefield', 'filter', 'forum', - 'i18nmenu', 'i18ntaxonomy', 'imagecache', 'imagefield', @@ -176,6 +175,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { 'i18nblocks', 'i18ncck', 'i18ncontent', + 'i18nmenu', // This module is in the missing path list because it is installed on the // source site but it is not installed on the destination site. 'i18nprofile', diff --git a/core/modules/system/src/Plugin/migrate/source/Extension.php b/core/modules/system/src/Plugin/migrate/source/Extension.php deleted file mode 100644 index 379939110d0..00000000000 --- a/core/modules/system/src/Plugin/migrate/source/Extension.php +++ /dev/null @@ -1,66 +0,0 @@ -select('system', 's') - ->fields('s'); - - if (isset($this->configuration['name'])) { - $query->condition('name', (array) $this->configuration['name'], 'IN'); - } - return $query; - } - - /** - * {@inheritdoc} - */ - public function fields() { - $fields = [ - 'filename' => $this->t('Filename'), - 'name' => $this->t('Name'), - 'type' => $this->t('Type'), - 'owner' => $this->t('Owner'), - 'status' => $this->t('Status'), - 'throttle' => $this->t('Throttle'), - 'bootstrap' => $this->t('Bootstrap'), - 'schema_version' => $this->t('Schema version'), - 'weight' => $this->t('Weight'), - 'info' => $this->t('Information array'), - ]; - return $fields; - } - - /** - * {@inheritdoc} - */ - public function prepareRow(Row $row) { - $row->setSourceProperty('info', unserialize($row->getSourceProperty('info'))); - return parent::prepareRow($row); - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['name']['type'] = 'string'; - return $ids; - } - -} diff --git a/core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php b/core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php deleted file mode 100644 index c6576019a76..00000000000 --- a/core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php +++ /dev/null @@ -1,77 +0,0 @@ - 'sites/all/modules/i18n/i18nmenu/i18nmenu.module', - 'name' => 'i18nmenu', - 'type' => 'module', - 'owner' => '', - 'status' => '1', - 'throttle' => '0', - 'bootstrap' => '0', - 'schema_version' => '0', - 'weight' => '0', - 'info' => 'a:10:{s:4:"name";s:16:"Menu translation";s:11:"description";s:40:"Supports translatable custom menu items.";s:12:"dependencies";a:4:{i:0;s:4:"i18n";i:1;s:4:"menu";i:2;s:10:"i18nblocks";i:3;s:11:"i18nstrings";}s:7:"package";s:13:"Multilanguage";s:4:"core";s:3:"6.x";s:7:"version";s:8:"6.x-1.10";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1318336004";s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";},', - ], - [ - 'filename' => 'sites/all/modules/variable/variable.module ', - 'name' => 'variable', - 'type' => 'module', - 'owner' => '', - 'status' => '1', - 'throttle' => '0', - 'bootstrap' => '0', - 'schema_version' => '-1', - 'weight' => '0', - 'info' => 'a:9:{s:4:"name";s:12:"Variable API";s:11:"description";s:12:"Variable API";s:4:"core";s:3:"6.x";s:7:"version";s:14:"6.x-1.0-alpha1";s:7:"project";s:8:"variable";s:9:"datestamp";s:10:"1414059742";s:12:"dependencies";a:0:{}s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";}', - ], - ]; - - $info = unserialize('a:9:{s:4:"name";s:12:"Variable API";s:11:"description";s:12:"Variable API";s:4:"core";s:3:"6.x";s:7:"version";s:14:"6.x-1.0-alpha1";s:7:"project";s:8:"variable";s:9:"datestamp";s:10:"1414059742";s:12:"dependencies";a:0:{}s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";}'); - $test[0]['expected_results'] = [ - [ - 'filename' => 'sites/all/modules/variable/variable.module ', - 'name' => 'variable', - 'type' => 'module', - 'owner' => '', - 'status' => '1', - 'throttle' => '0', - 'bootstrap' => '0', - 'schema_version' => '-1', - 'weight' => '0', - 'info' => $info, - ], - ]; - - $test[0]['expected_count'] = NULL; - $test[0]['configuration'] = [ - 'name' => 'variable', - ]; - - return $test; - } - -}