diff -u b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php --- b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -335,8 +335,7 @@ * The current state of the form. */ public function submitOverviewForm(array &$form, FormStateInterface $form_state) { - $form_state->set('step', 'credentials'); - $form_state->setRebuild(); + $form_state->set('step', 'credentials')->setRebuild(); } /** @@ -366,8 +365,7 @@ } } if (empty($valid_legacy_database)) { - $form_state->setValue('step', 'credentials'); - $form_state->setRebuild(); + $form_state->setValue('step', 'credentials')->setRebuild(); } } @@ -380,8 +378,7 @@ * The current state of the form. */ public function submitIncrementalForm(array &$form, FormStateInterface $form_state) { - $form_state->set('step', 'confirm_id_conflicts'); - $form_state->setRebuild(); + $form_state->set('step', 'confirm_id_conflicts')->setRebuild(); } /** @@ -986,7 +983,11 @@ } /** - * Setup migrations. + * Puts migrations information in form state. + * + * Gets all the migrations, converts each to an array and stores it in the + * form state. The source base path for public and private files is also + * put into form state. * * @param array $database * Database array representing the source Drupal database. @@ -1019,7 +1020,7 @@ $form_state->set('source_base_path', $form_state->getValue('source_base_path')); } $form_state->set('source_private_file_path', $form_state->getValue('source_private_file_path')); - // Store the retrived system data in form storage. + // Store the retrieved system data in form storage. $form_state->set('system_data', $system_data); } diff -u b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php --- b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php @@ -92,8 +92,14 @@ $this->drupalPostForm(NULL, $edits, t('Review upgrade')); $this->assertIdConflict($session); - $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.')); - $session->statusCodeEquals(200); + $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.')); + // 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(); @@ -102,6 +108,7 @@ $this->drupalPostForm(NULL, [], t('Perform upgrade')); $this->assertText(t('Congratulations, you upgraded Drupal!')); + $this->assertMigrationResults($this->getEntityCounts(), $version); \Drupal::service('module_installer')->install(['forum']); \Drupal::service('module_installer')->install(['book']); @@ -109,7 +116,6 @@ // Test incremental migration. $this->createContentPostUpgrade(); - // Need to update available and missing path lists. $this->drupalGet('/upgrade'); $session->pageTextContains('An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal 8. Rollbacks are not yet supported through the user interface.'); $this->drupalPostForm(NULL, [], t('Import new configuration and content from old site')); @@ -122,6 +128,8 @@ $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.')); $session->statusCodeEquals(200); + + // Need to update available and missing path lists. $all_available = $this->getAvailablePaths(); $all_available[] = 'aggregator'; $all_missing = $this->getMissingPaths(); diff -u b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php --- b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php @@ -187,18 +187,17 @@ */ abstract protected function getEntityCountsIncremental(); - /** * Helper method to assert the text on the 'Upgrade analysis report' page. * - * @param $session - * The currenct session. - * @param $all_available + * @param \Drupal\Tests\WebAssert $session + * The current session. + * @param array $all_available * Array of modules that will be upgraded. - * @param $all_missing + * @param array $all_missing * Array of modules that will not be upgraded. */ - protected function assertReviewPage($session, $all_available, $all_missing) { + protected function assertReviewPage(WebAssert $session, array $all_available, array $all_missing) { $this->assertText('Upgrade analysis report'); // Ensure there are no errors about the missing modules from the test module. @@ -224,10 +223,12 @@ /** * Helper method that asserts text on the ID conflict form. * + * @param \Drupal\Tests\WebAssert $session + * The current session. * @param $session - * The currenct session. + * The current session. */ - protected function assertIdConflict($session) { + 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('custom block entities'); @@ -246,8 +247,8 @@ * * @param array $expected_counts * The expected counts of each entity type. - * @param string $version - * The drupal verison. + * @param int $version + * The Drupal version. */ protected function assertMigrationResults(array $expected_counts, $version) { // Have to reset all the statics after migration to ensure entities are @@ -258,6 +259,7 @@ $expected_count = isset($expected_counts[$entity_type]) ? $expected_counts[$entity_type] : 0; $this->assertSame($expected_count, $real_count, "Found $real_count $entity_type entities, expected $expected_count."); } + $plugin_manager = \Drupal::service('plugin.manager.migration'); /** @var \Drupal\migrate\Plugin\Migration[] $all_migrations */ $all_migrations = $plugin_manager->createInstancesByTag('Drupal ' . $version); @@ -274,15 +276,10 @@ // A completed migration should have maps with // MigrateIdMapInterface::STATUS_IGNORED or // MigrateIdMapInterface::STATUS_IMPORTED. - if ($row['source_row_status'] == MigrateIdMapInterface::STATUS_FAILED || $row['source_row_status'] == MigrateIdMapInterface::STATUS_NEEDS_UPDATE) { - $this->fail($message); - } - else { - $this->pass($message); - } + $this->assertNotSame(MigrateIdMapInterface::STATUS_FAILED, $row['source_row_status'], $message); + $this->assertNotSame(MigrateIdMapInterface::STATUS_NEEDS_UPDATE, $row['source_row_status'], $message); } } - } } diff -u b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php --- b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php @@ -86,12 +86,12 @@ 'user' => 7, 'user_role' => 6, 'menu_link_content' => 5, - 'view' => 14, + 'view' => 16, 'date_format' => 11, 'entity_form_display' => 29, 'entity_form_mode' => 1, - 'entity_view_display' => 50, - 'entity_view_mode' => 12, + 'entity_view_display' => 53, + 'entity_view_mode' => 14, 'base_field_override' => 38, ]; } diff -u b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php --- b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php @@ -86,12 +86,12 @@ 'user' => 4, 'user_role' => 3, 'menu_link_content' => 8, - 'view' => 14, + 'view' => 16, 'date_format' => 11, 'entity_form_display' => 17, 'entity_form_mode' => 1, - 'entity_view_display' => 25, - 'entity_view_mode' => 12, + 'entity_view_display' => 28, + 'entity_view_mode' => 14, 'base_field_override' => 9, ]; } @@ -103,14 +103,11 @@ $counts = $this->getEntityCounts(); $counts['block_content'] = 2; $counts['comment'] = 2; - $counts['entity_view_display'] = 28; - $counts['entity_view_mode'] = 14; $counts['file'] = 4; $counts['menu_link_content'] = 9; $counts['node'] = 6; $counts['taxonomy_term'] = 19; $counts['user'] = 5; - $counts['view'] = 16; return $counts; }