From fe1e9a57c48ccac1a3aa6cfb5f6b471fb506b1bf Mon Sep 17 00:00:00 2001 From: Francesco Placella Date: Mon, 12 Mar 2018 12:40:14 +0100 Subject: [PATCH] Issue #2951684 by alexpott, quietone: Undefined index ReviewForm->buildForm() line 240 --- .../migrate_drupal_ui/src/Form/ReviewForm.php | 2 +- .../MigrateUpgradeReviewPageTestBase.php | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php b/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php index 19dd60b3571..5fc6446945f 100644 --- a/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php @@ -237,7 +237,7 @@ class ReviewForm extends MigrateUpgradeFormBase { // Add source_module and destination_module for modules that do not need an // upgrade path and are enabled on the source site. foreach ($this->noUpgradePaths[$version] as $extension) { - if ($system_data['module'][$extension]['status']) { + if (isset($system_data['module'][$extension]) && $system_data['module'][$extension]['status']) { $table_data[$extension]['core'][$extension] = $extension; } } 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 4138bea5b5b..af2916a6314 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php @@ -112,6 +112,28 @@ abstract class MigrateUpgradeReviewPageTestBase extends MigrateUpgradeTestBase { $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); } /**