X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate_drupal_ui%2Ftests%2Fsrc%2FFunctional%2FMigrateUpgradeReviewPageTestBase.php;fp=web%2Fcore%2Fmodules%2Fmigrate_drupal_ui%2Ftests%2Fsrc%2FFunctional%2FMigrateUpgradeReviewPageTestBase.php;h=4138bea5b5b6acabf6da49126284d3eeab7b3aef;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php b/web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php new file mode 100644 index 000000000..4138bea5b --- /dev/null +++ b/web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php @@ -0,0 +1,131 @@ +sourceDatabase->getConnectionOptions(); + $driver = $connection_options['driver']; + $connection_options['prefix'] = $connection_options['prefix']['default']; + + // Use the driver connection form to get the correct options out of the + // database settings. This supports all of the databases we test against. + $drivers = drupal_get_database_types(); + $form = $drivers[$driver]->getFormOptions($connection_options); + $connection_options = array_intersect_key($connection_options, $form + $form['advanced_options']); + $version = $this->getLegacyDrupalVersion($this->sourceDatabase); + $edit = [ + $driver => $connection_options, + 'source_private_file_path' => $this->getSourceBasePath(), + 'version' => $version, + ]; + if ($version == 6) { + $edit['d6_source_base_path'] = $this->getSourceBasePath(); + } + else { + $edit['source_base_path'] = $this->getSourceBasePath(); + } + if (count($drivers) !== 1) { + $edit['driver'] = $driver; + } + $edits = $this->translatePostValues($edit); + + // Enable all modules in the source except test and example modules, but + // include simpletest. + /** @var \Drupal\Core\Database\Query\SelectInterface $update */ + $update = $this->sourceDatabase->update('system') + ->fields(['status' => 1]) + ->condition('type', 'module'); + $and = $update->andConditionGroup() + ->condition('name', '%test%', 'NOT LIKE') + ->condition('name', '%example%', 'NOT LIKE'); + $conditions = $update->orConditionGroup(); + $conditions->condition($and); + $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); + } + + /** + * {@inheritdoc} + */ + protected function getEntityCounts() { + return []; + } + + /** + * {@inheritdoc} + */ + protected function getEntityCountsIncremental() { + return []; + } + +}