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 @@ -111,6 +111,29 @@ * Executes all steps of migrations upgrade. */ public function testMigrateUpgrade() { + $driver = $this->sourceDatabase->getConnectionOptions()['driver']; + $edits = $this->getUiEditsArray(); + + // Ensure submitting the form with invalid database credentials gives us a + // nice warning. + $this->drupalPostForm(NULL, [$driver . '[database]' => 'wrong'] + $edits, t('Review upgrade')); + $this->assertText('Resolve the issue below to continue the upgrade.'); + + $this->drupalPostForm(NULL, $edits, t('Review upgrade')); + $this->assertResponse(200); + $this->assertText('Are you sure?'); + $this->drupalPostForm(NULL, [], t('Perform upgrade')); + $this->assertText(t('Congratulations, you upgraded Drupal!')); + + $this->runPostMigrationTests(); + } + + /** + * Build a re-usable form $edits array for the UI. + * + * @return array $edits + */ + protected function getUiEditsArray() { $connection_options = $this->sourceDatabase->getConnectionOptions(); $this->drupalGet('/upgrade'); $this->assertText('Upgrade a site by importing it into a clean and empty new install of Drupal 8. You will lose any existing configuration once you import your site into it. See the online documentation for Drupal site upgrades for more detailed information.'); @@ -137,20 +160,14 @@ if (count($drivers) !== 1) { $edit['driver'] = $driver; } - $edits = $this->translatePostValues($edit); - - // Ensure submitting the form with invalid database credentials gives us a - // nice warning. - $this->drupalPostForm(NULL, [$driver . '[database]' => 'wrong'] + $edits, t('Review upgrade')); - $this->assertText('Resolve the issue below to continue the upgrade.'); - - $this->drupalPostForm(NULL, $edits, t('Review upgrade')); - $this->assertResponse(200); - $this->assertText('Are you sure?'); - $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data, continue anyway.')); - $this->drupalPostForm(NULL, [], t('Perform upgrade')); - $this->assertText(t('Congratulations, you upgraded Drupal!')); + return $this->translatePostValues($edit); + } + /** + * Runs all post migration tests. + */ + protected function runPostMigrationTests() { + $version = $this->getLegacyDrupalVersion($this->sourceDatabase); // Have to reset all the statics after migration to ensure entities are // loadable. $this->resetAll(); @@ -183,12 +200,10 @@ $this->fail($message); } else { - $this->pass($message); + $this->assertTrue(TRUE, $message); } } } - \Drupal::service('module_installer')->install(['forum']); - \Drupal::service('module_installer')->install(['book']); } /** only in patch2: unchanged: --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php @@ -15,6 +15,21 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase { /** + * Modules to enable. + * + * @var array + */ + public static $modules = [ + 'language', + 'content_translation', + 'migrate_drupal_ui', + 'telephone', + 'aggregator', + 'book', + 'statistics', + ]; + + /** * {@inheritdoc} */ protected function setUp() { only in patch2: unchanged: --- /dev/null +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgradeConflicts6Test.php @@ -0,0 +1,55 @@ +sourceDatabase->getConnectionOptions()['driver']; + $edits = $this->getUiEditsArray(); + + // Ensure submitting the form with invalid database credentials gives us a + // nice warning. + $this->drupalPostForm(NULL, [$driver . '[database]' => 'wrong'] + $edits, t('Review upgrade')); + $this->assertText('Resolve the issue below to continue the upgrade.'); + + $this->drupalPostForm(NULL, $edits, t('Review upgrade')); + $this->assertResponse(200); + $this->assertText('Are you sure?'); + $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data, continue anyway.')); + $this->drupalPostForm(NULL, [], t('Perform upgrade')); + $this->assertText(t('Congratulations, you upgraded Drupal!')); + + $this->runPostMigrationTests(); + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgradeConflicts7Test.php @@ -0,0 +1,55 @@ +sourceDatabase->getConnectionOptions()['driver']; + $edits = $this->getUiEditsArray(); + + // Ensure submitting the form with invalid database credentials gives us a + // nice warning. + $this->drupalPostForm(NULL, [$driver . '[database]' => 'wrong'] + $edits, t('Review upgrade')); + $this->assertText('Resolve the issue below to continue the upgrade.'); + + $this->drupalPostForm(NULL, $edits, t('Review upgrade')); + $this->assertResponse(200); + $this->assertText('Are you sure?'); + $this->drupalPostForm(NULL, [], t('I acknowledge I may lose data, continue anyway.')); + $this->drupalPostForm(NULL, [], t('Perform upgrade')); + $this->assertText(t('Congratulations, you upgraded Drupal!')); + + $this->runPostMigrationTests(); + } + +}