You are here

protected function MigrateMediaTestBase::submitMigrateUpgradeSourceConnectionForm in Media Migration 8

Submits the Migrate Upgrade source connection and files form.

2 calls to MigrateMediaTestBase::submitMigrateUpgradeSourceConnectionForm()
MediaWysiwygTest::testNoMissingPluginForComment in tests/src/Functional/MediaWysiwygTest.php
Tests that a "MediaWysiwyg plugin was not found" message is not shown.
MigrateMediaTestBase::assertMigrateUpgradeViaUi in tests/src/Functional/MigrateMediaTestBase.php
Executes the upgrade process by the UI and asserts basic expectations.

File

tests/src/Functional/MigrateMediaTestBase.php, line 438

Class

MigrateMediaTestBase
Provides a base class for testing media migration via the UI.

Namespace

Drupal\Tests\media_migration\Functional

Code

protected function submitMigrateUpgradeSourceConnectionForm() {
  $connection_options = $this->sourceDatabase
    ->getConnectionOptions();
  $this
    ->drupalGet('/upgrade');
  $session = $this
    ->assertSession();
  $session
    ->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal {$this->destinationSiteVersion}.");
  $this
    ->drupalPostForm(NULL, [], $this
    ->t('Continue'));
  $session
    ->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
  $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
      ->getSourcePrivateFilesPath(),
    'version' => $version,
    'source_base_path' => $this
      ->getSourceBasePath(),
  ];
  if (count($drivers) !== 1) {
    $edit['driver'] = $driver;
  }
  $edits = $this
    ->translatePostValues($edit);
  $this
    ->drupalPostForm(NULL, $edits, $this
    ->t('Review upgrade'));
}