Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / migrate_drupal_ui / src / Tests / MigrateUpgradeTestBase.php
index b635f2ab22170923a98d23c99f102e90e8ad9784..e39adee22f2ab60514c583a5f1229d3bd0587f70 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\migrate_drupal_ui\Tests;
 
+@trigger_error('\Drupal\migrate_drupal_ui\Tests\MigrateUpgradeTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase instead.', E_USER_DEPRECATED);
+
 use Drupal\Core\Database\Database;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
 use Drupal\migrate_drupal\MigrationConfigurationTrait;
@@ -9,12 +11,17 @@ use Drupal\simpletest\WebTestBase;
 
 /**
  * Provides a base class for testing migration upgrades in the UI.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use
+ *   \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase instead.
  */
 abstract class MigrateUpgradeTestBase extends WebTestBase {
   use MigrationConfigurationTrait;
 
   /**
    * Use the Standard profile to test help implementations of many core modules.
+   *
+   * @var string
    */
   protected $profile = 'standard';
 
@@ -39,6 +46,7 @@ abstract class MigrateUpgradeTestBase extends WebTestBase {
     'book',
     'forum',
     'statistics',
+    'modules_available_test',
   ];
 
   /**
@@ -113,7 +121,7 @@ abstract class MigrateUpgradeTestBase extends WebTestBase {
   public function testMigrateUpgrade() {
     $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.');
+    $this->assertText('Upgrade a site by importing its database and files into a clean and empty new install of Drupal 8.');
 
     $this->drupalPostForm(NULL, [], t('Continue'));
     $this->assertText('Provide credentials for the database of the Drupal site you want to upgrade.');
@@ -143,7 +151,31 @@ abstract class MigrateUpgradeTestBase extends WebTestBase {
 
     $this->drupalPostForm(NULL, $edits, t('Review upgrade'));
     $this->assertResponse(200);
-    $this->assertText('Are you sure?');
+    $this->assertText('Upgrade analysis report');
+    // Ensure we get errors about missing modules.
+    $this->assertText(t('Source module not found for module_no_annotation.'));
+    $this->assertText(t('Source module not found for modules_available_test.'));
+    $this->assertText(t('Destination module not found for modules_available_test'));
+
+    // Uninstall the module causing the missing module error messages.
+    $this->container->get('module_installer')->uninstall(['modules_available_test'], TRUE);
+
+    // Restart the upgrade process.
+    $this->drupalGet('/upgrade');
+    $this->assertText('Upgrade a site by importing its database and files into a clean and empty new install of Drupal 8.');
+
+    $this->drupalPostForm(NULL, [], t('Continue'));
+    $this->assertText('Provide credentials for the database of the Drupal site you want to upgrade.');
+    $this->assertFieldByName('mysql[host]');
+
+    $this->drupalPostForm(NULL, $edits, t('Review upgrade'));
+    $this->assertResponse(200);
+    $this->assertText('Upgrade analysis report');
+    // Ensure there are no errors about the missing modules.
+    $this->assertNoText(t('Source module not found for module_no_annotation.'));
+    $this->assertNoText(t('Source module not found for modules_available_test.'));
+    $this->assertNoText(t('Destination module not found for modules_available_test'));
+    // Check for any missing module errors.
     $this->drupalPostForm(NULL, [], t('Perform upgrade'));
     $this->assertText(t('Congratulations, you upgraded Drupal!'));