diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php index 19a8b24..1b4aaa3 100644 --- a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php +++ b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php @@ -70,11 +70,11 @@ public function testProvidersExist() { public function testFieldProvidersExist() { $expected_mappings = [ 'userreference' => [ - 'source_module' => 'user_reference', + 'source_module' => 'userreference', 'destination_module' => 'core', ], 'nodereference' => [ - 'source_module' => 'node_reference', + 'source_module' => 'nodereference', 'destination_module' => 'core', ], 'optionwidgets' => [ diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php b/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php index ba69b78..d2b3a3f 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php @@ -11,7 +11,7 @@ * type_map = { * "nodereference" = "entity_reference", * }, - * source_module = "node_reference", + * source_module = "nodereference", * destination_module = "core", * ) */ diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php b/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php index 0c8e9ba..bead7bc 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php @@ -11,7 +11,7 @@ * type_map = { * "userreference" = "entity_reference", * }, - * source_module = "user_reference", + * source_module = "userreference", * destination_module = "core", * ) */ diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php index 6bfaf42..414206f 100644 --- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -67,6 +67,59 @@ class MigrateUpgradeForm extends ConfirmFormBase { protected $moduleHandler; /** + * List of modules, themes and profiles that do not need an upgrade path. + */ + public static $noUpgradePath = [ + '6' => [ + 'blog', + 'color', + 'date_timezone', + 'date_api', + 'help', + 'i18n', + 'i18nstrings', + 'imageapi', + 'minimal', + 'number', + 'openid', + 'php', + 'poll', + 'profile', + 'trigger', + 'tracker', + 'standard', + 'variable', + 'variable_admin', + 'views', + 'views_export', + 'views_ui', + ], + '7' => [ + 'blog', + 'contextual', + 'dashboard', + 'date_api', + 'entity', + 'field_ui', + 'help', + 'minimal', + 'openid', + 'overlay', + 'php', + 'poll', + 'profile', + 'simpletest', + 'standard', + 'syslog', + 'trigger', + 'toolbar', + 'update', + 'views', + 'views_ui', + ], + ]; + + /** * Constructs the MigrateUpgradeForm. * * @param \Drupal\Core\State\StateInterface $state @@ -507,9 +560,18 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { // Get the source_module and destination_module from the field plugins. $definitions = $this->fieldPluginManager->getDefinitions(); foreach ($definitions as $definition) { - $source_module = $definition['source_module']; - $destination_module = $definition['destination_module']; - $table_data[$source_module][$destination_module][$definition['id']] = $definition['id']; + if (in_array($version, $definition['core'])) { + $source_module = $definition['source_module']; + $destination_module = $definition['destination_module']; + $table_data[$source_module][$destination_module][$definition['id']] = $definition['id']; + } + } + + // Add source_module and destination_module for modules that do not need an + // upgrade path. + $no_upgrade_path = ($version == '6') ? static::$noUpgradePath['6'] : static::$noUpgradePath['7']; + foreach ($no_upgrade_path as $module) { + $table_data[$module]['core'][$module] = $module; } // Sort the table by source module names and within that destination @@ -519,13 +581,6 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { ksort($table_data[$source_module]); } - // Fetch the system data at the first opportunity. - $system_data = $form_state->get('system_data'); - // Remove core profiles from the system data. - foreach (['standard', 'minimal'] as $profile) { - unset($system_data['module'][$profile]); - } - $unmigrated_source_modules = array_diff_key($system_data['module'], $table_data); // Missing migrations. diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php index d5cc939..f24fe6a 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php @@ -11,6 +11,7 @@ * Provides a base class for testing migration upgrades in the UI. */ abstract class MigrateUpgradeTestBase extends BrowserTestBase { + use MigrationConfigurationTrait; /** @@ -45,6 +46,20 @@ ]; /** + * Count of modules that will not be upgraded. + * + * @var array + */ + public static $missing_count; + + /** + * Count of modules that will be upgraded. + * + * @var array + */ + public static $available_count; + + /** * {@inheritdoc} */ protected function setUp() { @@ -196,6 +211,10 @@ public function testMigrateUpgrade() { $session->elementNotExists('xpath', "//span[contains(@class, 'checked') and text() = '$missing']"); } + // Test the total count of missing and available paths. + $session->elementsCount('xpath', "//span[contains(@class, 'upgrade-analysis-report__status-icon--warning')]", (int) static::$missing_count); + $session->elementsCount('xpath', "//span[contains(@class, 'upgrade-analysis-report__status-icon--checked')]", (int) static::$available_count); + $this->drupalPostForm(NULL, [], t('Perform upgrade')); $this->assertText(t('Congratulations, you upgraded Drupal!')); 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 3717606..98e6fd1 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 @@ -17,6 +17,16 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase { /** * {@inheritdoc} */ + public static $missing_count = 6; + + /** + * {@inheritdoc} + */ + public static $available_count = 52; + + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php'); @@ -93,25 +103,19 @@ protected function getAvailablePaths() { 'date', 'dblog', 'email', - 'entityreference', - 'file', 'filefield', 'filter', + 'forum', 'i18ntaxonomy', - 'image', 'imagecache', 'imagefield', 'link', - 'list', 'menu', 'locale', 'node', - 'node_reference', - 'number', - 'options', + 'nodereference', 'optionwidgets', 'path', - 'phone', 'profile', 'search', 'system', @@ -120,28 +124,39 @@ protected function getAvailablePaths() { 'translation', 'upload', 'user', - 'user_reference', - ]; - } - - /** - * {@inheritdoc} - */ - protected function getMissingPaths() { - return [ - 'date_api', + 'userreference', + // Modules that have no upgrade path. + 'blog', + 'color', 'date_timezone', - 'event', + 'date_api', + 'help', 'i18n', - 'i18nblocks', - 'i18ncck', - 'i18ncontent', - 'i18nmenu', - 'i18nprofile', 'i18nstrings', 'imageapi', + 'openid', 'php', + 'poll', + 'profile', + 'trigger', + 'tracker', + 'variable', 'variable_admin', + 'views', + 'views_export', + 'views_ui', + ]; + } + + /** + * {@inheritdoc} + */ + protected function getMissingPaths() { + return [ + 'event', + 'i18nblocks', + 'i18ncck', + 'i18ncontent', ]; } 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 3cfe4bc..9ffcff9 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 @@ -22,6 +22,16 @@ class MigrateUpgrade7Test extends MigrateUpgradeTestBase { /** * {@inheritdoc} */ + public static $missing_count = 4; + + /** + * {@inheritdoc} + */ + public static $available_count = 51; + + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal7.php'); @@ -99,20 +109,16 @@ protected function getAvailablePaths() { 'field', 'field_sql_storage', 'file', - 'filefield', 'filter', 'forum', 'image', - 'imagefield', 'link', 'list', 'locale', 'menu', 'node', - 'node_reference', 'number', 'options', - 'optionwidgets', 'path', 'phone', 'search', @@ -123,31 +129,37 @@ protected function getAvailablePaths() { 'text', 'translation', 'user', - 'user_reference', - ]; - } - - /** - * {@inheritdoc} - */ - protected function getMissingPaths() { - return [ + 'update', + // Modules that have no upgrade path. 'blog', - 'book', - 'color', 'contextual', + 'dashboard', 'date_api', 'entity', 'field_ui', 'help', + 'openid', + 'overlay', 'php', - 'rdf', + 'poll', + 'profile', 'simpletest', 'syslog', - 'toolbar', - 'tracker', 'trigger', - 'update', + 'toolbar', + 'views', + 'views_ui', + ]; + } + + /** + * {@inheritdoc} + */ + protected function getMissingPaths() { + return [ + 'book', + 'color', + 'rdf', ]; }