diff --git a/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml b/core/modules/content_translation/migrations/d6_menu_links_translation.yml similarity index 100% rename from core/modules/menu_link_content/migrations/d6_menu_links_translation.yml rename to core/modules/content_translation/migrations/d6_menu_links_translation.yml 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 index 21911f06f419038b6a152cda4417fb9b30b07a85..4863dde76fd88ae308c89180b3371fb9a3fef28b 100644 --- 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 @@ -15,7 +15,12 @@ class MigrateMenuLinkTranslationTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ - public static $modules = ['menu_ui', 'menu_link_content', 'language']; + public static $modules = [ + 'menu_ui', + 'menu_link_content', + 'language', + 'content_translation', + ]; /** * {@inheritdoc} diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeI18nReviewPageTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeI18nReviewPageTestBase.php new file mode 100644 index 0000000000000000000000000000000000000000..8a57115edf7f4c4640dc6235a110e5ce971bf1d3 --- /dev/null +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeI18nReviewPageTestBase.php @@ -0,0 +1,45 @@ +prepare(); + // Start the upgrade process. + $this->drupalGet('/upgrade'); + $this->drupalPostForm(NULL, [], t('Continue')); + $this->drupalPostForm(NULL, $this->edits, t('Review upgrade')); + + $session = $this->assertSession(); + $session->pageTextContains('WARNING: Content may be overwritten on your new site.'); + $session->pageTextContains('There is conflicting content of these types:'); + $session->pageTextContains('taxonomy terms'); + $session->pageTextNotContains('There is translated content of these types:'); + $session->pageTextNotContains('custom menu links'); + + $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.')); + $session->statusCodeEquals(200); + + // Ensure there are no errors about missing modules from the test module. + $session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.')); + $session->pageTextNotContains(t('Source module not found for migration_provider_test.')); + $session->pageTextNotContains(t('Destination module not found for migration_provider_test')); + // Ensure there are no errors about any other missing migration providers. + $session->pageTextNotContains(t('module not found')); + + // Test the upgrade paths. + $available_paths = $this->getAvailablePaths(); + $missing_paths = $this->getMissingPaths(); + $this->assertUpgradePaths($session, $available_paths, $missing_paths); + } + +} diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php index 54fb0ba5f34ca2be4e365688e98d0d3fcfc10f65..5c97a69070dcedda5ceaaf1ebcaa40f7fb8c235f 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php @@ -11,22 +11,17 @@ abstract class MigrateUpgradeReviewPageTestBase extends MigrateUpgradeTestBase { use CreateTestContentEntitiesTrait; + /** + * An array suitable for drupalPostForm(). + * + * @var array + */ + protected $edits = []; + /** * {@inheritdoc} */ - public static $modules = [ - 'language', - 'content_translation', - 'migrate_drupal_ui', - 'telephone', - 'aggregator', - 'book', - 'forum', - 'statistics', - 'syslog', - 'tracker', - 'update', - ]; + public static $modules = ['migrate_drupal_ui']; /** * Tests the migrate upgrade review form. @@ -51,6 +46,56 @@ abstract class MigrateUpgradeReviewPageTestBase extends MigrateUpgradeTestBase { * @see \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase */ public function testMigrateUpgradeReviewPage() { + $this->prepare(); + // Start the upgrade process. + $this->drupalGet('/upgrade'); + $this->drupalPostForm(NULL, [], t('Continue')); + $this->drupalPostForm(NULL, $this->edits, t('Review upgrade')); + $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.')); + + // Ensure there are no errors about missing modules from the test module. + $session = $this->assertSession(); + $session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.')); + $session->pageTextNotContains(t('Source module not found for migration_provider_test.')); + $session->pageTextNotContains(t('Destination module not found for migration_provider_test')); + // Ensure there are no errors about any other missing migration providers. + $session->pageTextNotContains(t('module not found')); + + // Test the upgrade paths. + $available_paths = $this->getAvailablePaths(); + $missing_paths = $this->getMissingPaths(); + $this->assertUpgradePaths($session, $available_paths, $missing_paths); + + // Check there are no errors when a module in noUpgradePaths is not in the + // source system tables. Test with a module that is listed in noUpgradePaths + // for both Drupal 6 and Drupal 7. + // @see \Drupal\migrate_drupal_ui\Form\ReviewForm::$noUpgradePaths + $module = 'help'; + $query = $this->sourceDatabase->delete('system'); + $query->condition('type', 'module'); + $query->condition('name', $module); + $query->execute(); + + // Start the upgrade process. + $this->drupalGet('/upgrade'); + $this->drupalPostForm(NULL, [], t('Continue')); + $this->drupalPostForm(NULL, $this->edits, t('Review upgrade')); + $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.')); + + // Test the upgrade paths. + $available_paths = $this->getAvailablePaths(); + $available_paths = array_diff($available_paths, [$module]); + $missing_paths = $this->getMissingPaths(); + $this->assertUpgradePaths($session, $available_paths, $missing_paths); + } + + /** + * Performs preparation for the form tests. + * + * This is not done in setup because setup executes before the source database + * is loaded. + */ + public function prepare() { $connection_options = $this->sourceDatabase->getConnectionOptions(); $driver = $connection_options['driver']; $connection_options['prefix'] = $connection_options['prefix']['default']; @@ -75,7 +120,7 @@ public function testMigrateUpgradeReviewPage() { if (count($drivers) !== 1) { $edit['driver'] = $driver; } - $edits = $this->translatePostValues($edit); + $this->edits = $this->translatePostValues($edit); // Enable all modules in the source except test and example modules, but // include simpletest. @@ -91,47 +136,6 @@ public function testMigrateUpgradeReviewPage() { $conditions->condition('name', 'simpletest'); $update->condition($conditions); $update->execute(); - - // Start the upgrade process. - $this->drupalGet('/upgrade'); - $this->drupalPostForm(NULL, [], t('Continue')); - $this->drupalPostForm(NULL, $edits, t('Review upgrade')); - $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.')); - - // Ensure there are no errors about missing modules from the test module. - $session = $this->assertSession(); - $session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.')); - $session->pageTextNotContains(t('Source module not found for migration_provider_test.')); - $session->pageTextNotContains(t('Destination module not found for migration_provider_test')); - // Ensure there are no errors about any other missing migration providers. - $session->pageTextNotContains(t('module not found')); - - // Test the upgrade paths. - $available_paths = $this->getAvailablePaths(); - $missing_paths = $this->getMissingPaths(); - $this->assertUpgradePaths($session, $available_paths, $missing_paths); - - // Check there are no errors when a module in noUpgradePaths is not in the - // source system tables. Test with a module that is listed in noUpgradePaths - // for both Drupal 6 and Drupal 7. - // @see \Drupal\migrate_drupal_ui\Form\ReviewForm::$noUpgradePaths - $module = 'help'; - $query = $this->sourceDatabase->delete('system'); - $query->condition('type', 'module'); - $query->condition('name', $module); - $query->execute(); - - // Start the upgrade process. - $this->drupalGet('/upgrade'); - $this->drupalPostForm(NULL, [], t('Continue')); - $this->drupalPostForm(NULL, $edits, t('Review upgrade')); - $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.')); - - // Test the upgrade paths. - $available_paths = $this->getAvailablePaths(); - $available_paths = array_diff($available_paths, [$module]); - $missing_paths = $this->getMissingPaths(); - $this->assertUpgradePaths($session, $available_paths, $missing_paths); } /** 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 new file mode 100644 index 0000000000000000000000000000000000000000..b70fe436aae67b3ec1644986761c6e991b8828e5 --- /dev/null +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6I18nReviewPageTest.php @@ -0,0 +1,151 @@ +loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php'); + } + + /** + * {@inheritdoc} + */ + protected function getSourceBasePath() { + return __DIR__ . '/files'; + } + + /** + * {@inheritdoc} + */ + protected function getAvailablePaths() { + return [ + 'aggregator', + 'block', + 'book', + 'comment', + 'contact', + 'content', + 'date', + 'dblog', + 'email', + 'filefield', + 'filter', + 'forum', + 'i18ntaxonomy', + 'imagecache', + 'imagefield', + 'language', + 'link', + 'locale', + 'menu', + 'node', + 'nodereference', + 'optionwidgets', + 'path', + 'profile', + 'search', + 'statistics', + 'syslog', + 'system', + 'taxonomy', + 'text', + 'update', + 'upload', + 'user', + 'userreference', + // Include modules that do not have an upgrade path, defined in the + // $noUpgradePath property in MigrateUpgradeForm. + 'blog', + 'blogapi', + 'calendarsignup', + 'color', + 'content_copy', + 'content_multigroup', + 'content_permissions', + 'date_api', + 'date_locale', + 'date_php4', + 'date_popup', + 'date_repeat', + 'date_timezone', + 'date_tools', + 'datepicker', + 'ddblock', + 'event', + 'fieldgroup', + 'filefield_meta', + 'help', + 'i18n', + 'i18nstrings', + 'imageapi', + 'imageapi_gd', + 'imageapi_imagemagick', + 'imagecache_ui', + 'jquery_ui', + 'nodeaccess', + 'number', + 'openid', + 'php', + 'ping', + 'poll', + 'throttle', + 'tracker', + 'translation', + 'trigger', + 'variable', + 'variable_admin', + 'views_export', + 'views_ui', + ]; + } + + /** + * {@inheritdoc} + */ + protected function getMissingPaths() { + return [ + 'devel', + 'devel_generate', + 'devel_node_access', + 'i18nblocks', + 'i18ncck', + 'i18ncontent', + 'i18nmenu', + 'i18npoll', + 'i18nprofile', + 'i18nsync', + 'i18nviews', + 'phone', + 'views', + ]; + } + +} 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 798f0290d84ad47bd3ed9ccd41a054ec000b0d1a..1eeb326b13100bfcabf7587e2d7b92f3d296d58a 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 @@ -12,6 +12,22 @@ */ class MigrateUpgrade6ReviewPageTest extends MigrateUpgradeReviewPageTestBase { + /** + * {@inheritdoc} + */ + public static $modules = [ + 'language', + 'content_translation', + 'telephone', + 'aggregator', + 'book', + 'forum', + 'statistics', + 'syslog', + 'tracker', + 'update', + ]; + /** * {@inheritdoc} */ diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php index 12b66165aeb57b33648bdb8c390676e35ee903d4..44fe25de3064b38969dc0261a3549ede4e096a2b 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php @@ -12,6 +12,22 @@ */ class MigrateUpgrade7ReviewPageTest extends MigrateUpgradeReviewPageTestBase { + /** + * {@inheritdoc} + */ + public static $modules = [ + 'language', + 'content_translation', + 'telephone', + 'aggregator', + 'book', + 'forum', + 'statistics', + 'syslog', + 'tracker', + 'update', + ]; + /** * {@inheritdoc} */