diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php index 0fd45c4730..5ff495b266 100644 --- a/core/modules/migrate/src/Plugin/Migration.php +++ b/core/modules/migrate/src/Plugin/Migration.php @@ -434,13 +434,6 @@ public function getIdMap() { * {@inheritdoc} */ public function checkRequirements() { - // Multilingual migrations require the module migrate_drupal_multilingual. - $tags = $this->getMigrationTags() ? $this->getMigrationTags() : []; - if (in_array('Multilingual', $tags) && (!\Drupal::service('module_handler') - ->moduleExists('migrate_drupal_multilingual'))) { - throw new RequirementsException("The module migrate_drupal_multilingual is not enabled on the new site."); - } - // Check whether the current migration source and destination plugin // requirements are met or not. if ($this->getSourcePlugin() instanceof RequirementsInterface) { diff --git a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php index 0aca5be244..912f50fdae 100644 --- a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php +++ b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php @@ -113,6 +113,13 @@ protected function getMigrations($database_state_key, $drupal_version) { try { // @todo https://drupal.org/node/2681867 We should be able to validate // the entire migration at this point. + + // Multilingual migrations require the module migrate_drupal_multilingual. + $tags = $migration->getMigrationTags() ? $migration->getMigrationTags() : []; + if (in_array('Multilingual', $tags) && (!\Drupal::service('module_handler')->moduleExists('migrate_drupal_multilingual'))) { + throw new RequirementsException("The module migrate_drupal_multilingual is not enabled on the new site."); + } + $source_plugin = $migration->getSourcePlugin(); if ($source_plugin instanceof RequirementsInterface) { $source_plugin->checkRequirements(); diff --git a/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php b/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php index 403ef351f3..37117fc02c 100644 --- a/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php @@ -81,7 +81,6 @@ class ReviewForm extends MigrateUpgradeFormBase { 'fieldgroup', 'filefield_meta', 'help', - 'i18n', 'i18nstrings', 'imageapi', 'imageapi_gd', diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nReviewPageTest.php index adc3071e9e..a4deaa25cf 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nReviewPageTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nReviewPageTest.php @@ -102,7 +102,6 @@ protected function getAvailablePaths() { 'fieldgroup', 'filefield_meta', 'help', - 'i18n', 'i18nstrings', 'imageapi', 'imageapi_gd', @@ -134,6 +133,7 @@ protected function getMissingPaths() { 'devel', 'devel_generate', 'devel_node_access', + 'i18n', 'i18nblocks', 'i18ncck', 'i18ncontent', diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nTest.php index 6e6337bcd9..12086a484b 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nTest.php @@ -2,8 +2,10 @@ namespace Drupal\Tests\migrate_drupal_ui\Functional\d6; +use Drupal\node\Entity\Node; use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase; use Drupal\user\Entity\User; +use Drupal\Tests\WebAssert; /** * Tests Drupal 6 i18n upgrade using the migrate UI. @@ -12,7 +14,7 @@ * * @group migrate_drupal_ui */ -class MigrateUpgrade6I18nTest extends MigrateUpgrade6Test { +class MigrateUpgrade6I18nTest extends MigrateUpgradeExecuteTestBase { /** * Modules to enable. @@ -20,12 +22,35 @@ class MigrateUpgrade6I18nTest extends MigrateUpgrade6Test { * @var array */ public static $modules = [ - 'migrate_drupal_multilingual', + 'language', + 'content_translation', + 'migrate_drupal_ui', + 'telephone', + 'aggregator', + 'book', + 'forum', + 'statistics', + 'migration_provider_test', ]; /** * {@inheritdoc} */ + protected function setUp() { + parent::setUp(); + $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php'); + } + + /** + * {@inheritdoc} + */ + protected function getSourceBasePath() { + return __DIR__ . '/files'; + } + + /** + * {@inheritdoc} + */ protected function getEntityCounts() { return [ 'aggregator_item' => 1, @@ -108,9 +133,6 @@ protected function getAvailablePaths() { 'filefield', 'filter', 'forum', - 'i18nblocks', - 'i18nmenu', - 'i18ntaxonomy', 'imagecache', 'imagefield', 'language', @@ -136,7 +158,6 @@ protected function getAvailablePaths() { 'date_api', 'date_timezone', 'event', - 'i18n', 'i18nstrings', 'imageapi', 'number', @@ -151,12 +172,58 @@ protected function getAvailablePaths() { */ protected function getMissingPaths() { return [ + 'i18n', + 'i18nblocks', 'i18ncck', 'i18ncontent', - // 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. + 'i18nmenu', + 'i18npoll', 'i18nprofile', + 'i18nsync', + 'i18nviews', ]; } + /** + * Executes all steps of migrations upgrade. + */ + public function testMigrateUpgradeExecute() { + parent::testMigrateUpgradeExecute(); + + // Ensure migrated users can log in. + $user = User::load(2); + $user->passRaw = 'john.doe_pass'; + $this->drupalLogin($user); + $this->assertFollowUpMigrationResults(); + } + + /** + * Tests that follow-up migrations have been run successfully. + */ + protected function assertFollowUpMigrationResults() { + $node = Node::load(10); + $this->assertSame('12', $node->get('field_reference')->target_id); + $this->assertSame('12', $node->get('field_reference_2')->target_id); + $translation = $node->getTranslation('fr'); + $this->assertSame('12', $translation->get('field_reference')->target_id); + $this->assertSame('12', $translation->get('field_reference_2')->target_id); + + $node = Node::load(12)->getTranslation('en'); + $this->assertSame('10', $node->get('field_reference')->target_id); + $this->assertSame('10', $node->get('field_reference_2')->target_id); + $translation = $node->getTranslation('fr'); + $this->assertSame('10', $translation->get('field_reference')->target_id); + $this->assertSame('10', $translation->get('field_reference_2')->target_id); + } + + /** + * {@inheritdoc} + */ + protected function assertIdConflict(WebAssert $session) { + $session->pageTextContains('WARNING: Content may be overwritten on your new site.'); + $session->pageTextContains('There is conflicting content of these types:'); + $session->pageTextContains('aggregator feeds'); + $session->pageTextContains('files'); + } + } 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 a0a0eb238a..2d657eb8e7 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 @@ -23,6 +23,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { public static $modules = [ 'language', 'content_translation', + 'config_translation', 'migrate_drupal_ui', 'telephone', 'aggregator', @@ -30,6 +31,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { 'forum', 'statistics', 'migration_provider_test', + 'migrate_drupal_multilingual', ]; /** @@ -83,7 +85,7 @@ protected function getEntityCounts() { 'menu' => 8, 'taxonomy_term' => 8, 'taxonomy_vocabulary' => 7, - 'tour' => 4, + 'tour' => 5, 'user' => 7, 'user_role' => 6, 'menu_link_content' => 10, @@ -132,6 +134,12 @@ protected function getAvailablePaths() { 'filefield', 'filter', 'forum', + 'i18n', + 'i18nblocks', + 'i18nmenu', + 'i18nprofile', + 'i18nstrings', + 'i18ntaxonomy', 'imagecache', 'imagefield', 'language', @@ -157,8 +165,6 @@ protected function getAvailablePaths() { 'date_api', 'date_timezone', 'event', - 'i18n', - 'i18nstrings', 'imageapi', 'number', 'php', @@ -172,14 +178,8 @@ protected function getAvailablePaths() { */ protected function getMissingPaths() { return [ - 'i18nblocks', 'i18ncck', 'i18ncontent', - // 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. - 'i18nmenu', - 'i18nprofile', - 'i18ntaxonomy', ]; } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php index e53898384c..e520f8ff24 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php @@ -31,6 +31,7 @@ class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase { 'forum', 'statistics', 'migration_provider_test', + 'migrate_drupal_multilingual', ]; /** @@ -71,7 +72,7 @@ protected function getEntityCounts() { 'file' => 3, 'filter_format' => 7, 'image_style' => 6, - 'language_content_settings' => 2, + 'language_content_settings' => 6, 'migration' => 73, 'node' => 5, 'node_type' => 6,