function MigrateUpgradeTestBase::assertReviewForm

Same name and namespace in other branches
  1. 11.x core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase::assertReviewForm()

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

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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.