You are here

protected function MigrateMediaTestBase::assertMigrateUpgradeViaUi in Media Migration 8

Executes the upgrade process by the UI and asserts basic expectations.

Parameters

bool $assert_review_page: Whether the review page should be tested or not. Defaults to TRUE.

4 calls to MigrateMediaTestBase::assertMigrateUpgradeViaUi()
MigrateEmbedMediaTokenToEntityEmbedTest::testMediaTokenToEntityEmbedTransform in tests/src/Functional/MigrateEmbedMediaTokenToEntityEmbedTest.php
Tests the result of Media Migration's embed media token transform.
MigrateEmbedMediaTokenToMediaEmbedTest::testMediaTokenToMediaEmbedTransform in tests/src/Functional/MigrateEmbedMediaTokenToMediaEmbedTest.php
Tests the result of Media Migration's embed media token transform.
MigrateMediaFromNonMediaSourceTest::testPlainFileToMediaMigration in tests/src/Functional/MigrateMediaFromNonMediaSourceTest.php
Tests the result of the media migration.
MigrateMediaTest::testMediaMigrate in tests/src/Functional/MigrateMediaTest.php
Tests the result of the media migration.

File

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

Class

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

Namespace

Drupal\Tests\media_migration\Functional

Code

protected function assertMigrateUpgradeViaUi(bool $assert_review_page = TRUE) {
  $this
    ->submitMigrateUpgradeSourceConnectionForm();
  $session = $this
    ->assertSession();
  $session
    ->pageTextNotContains('Resolve all issues below to continue the upgrade.');

  // When complete node migration is executed, Drupal 8.9 and above (even 9.x)
  // will complain about content id conflicts. Drupal 8.8 and below won't.
  // @see https://www.drupal.org/node/2928118
  // @see https://www.drupal.org/node/3105503
  if (version_compare(\Drupal::VERSION, '8.9', '>=') && !Settings::get('migrate_node_migrate_type_classic', FALSE)) {
    $session
      ->buttonExists($this
      ->t('I acknowledge I may lose data. Continue anyway.'));
    $this
      ->drupalPostForm(NULL, [], $this
      ->t('I acknowledge I may lose data. Continue anyway.'));
    $session
      ->statusCodeEquals(200);
  }
  if ($assert_review_page) {

    // Test the review page.
    $available_paths = $this
      ->getAvailablePaths();
    $missing_paths = $this
      ->getMissingPaths();
    $this
      ->assertReviewPage($session, $available_paths, $missing_paths);
  }

  // Perform the upgrade.
  $this
    ->drupalPostForm(NULL, [], $this
    ->t('Perform upgrade'));
  $this
    ->assertText($this
    ->t('Congratulations, you upgraded Drupal!'));

  // Have to reset all the statics after migration to ensure entities are
  // loadable.
  $this
    ->resetAll();
}