You are here

protected function MigrateUpgradeTestBase::assertReviewForm in Drupal 9

Helper to assert content on the Review form.

Parameters

array|null $available_paths: An array of modules that will be upgraded. Defaults to $this->getAvailablePaths().

array|null $missing_paths: An array of modules that will not be upgraded. Defaults to $this->getMissingPaths().

Throws

\Behat\Mink\Exception\ExpectationException

3 calls to MigrateUpgradeTestBase::assertReviewForm()
MigrateUpgradeExecuteTestBase::doUpgradeAndIncremental in core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
Executes an upgrade and then an incremental upgrade.
MultilingualReviewPageTestBase::testMigrateUpgradeReviewPage in core/modules/migrate_drupal_ui/tests/src/Functional/MultilingualReviewPageTestBase.php
Tests the migrate upgrade review form.
NoMultilingualReviewPageTestBase::testMigrateUpgradeReviewPage in core/modules/migrate_drupal_ui/tests/src/Functional/NoMultilingualReviewPageTestBase.php
Tests the review page when content_translation is enabled.

File

core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php, line 206

Class

MigrateUpgradeTestBase
Provides a base class for testing migration upgrades in the UI.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

protected function assertReviewForm(array $available_paths = NULL, array $missing_paths = NULL) {
  $session = $this
    ->assertSession();
  $session
    ->pageTextContains('What will be upgraded?');
  $available_paths = $available_paths ?? $this
    ->getAvailablePaths();
  $missing_paths = $missing_paths ?? $this
    ->getMissingPaths();

  // Test the available migration paths.
  foreach ($available_paths as $available) {
    $session
      ->elementExists('xpath', "//td[contains(@class, 'checked') and text() = '{$available}']");
    $session
      ->elementNotExists('xpath', "//td[contains(@class, 'error') and text() = '{$available}']");
  }

  // Test the missing migration paths.
  foreach ($missing_paths as $missing) {
    $session
      ->elementExists('xpath', "//td[contains(@class, 'error') and text() = '{$missing}']");
    $session
      ->elementNotExists('xpath', "//td[contains(@class, 'checked') and text() = '{$missing}']");
  }

  // Test the total count of missing and available paths.
  $session
    ->elementsCount('xpath', "//td[contains(@class, 'upgrade-analysis-report__status-icon--error')]", count($missing_paths));
  $session
    ->elementsCount('xpath', "//td[contains(@class, 'upgrade-analysis-report__status-icon--checked')]", count($available_paths));
}