You are here

protected function MigrateUpgradeTestBase::assertUpgradePaths in Drupal 8

Tests the displayed upgrade paths.

Parameters

\Drupal\Tests\WebAssert $session: The web-assert session.

array $available_paths: An array of modules that will be upgraded.

array $missing_paths: An array of modules that will not be upgraded.

3 calls to MigrateUpgradeTestBase::assertUpgradePaths()
MigrateUpgradeTestBase::assertReviewPage in core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
Helper method to assert the text on the 'Upgrade analysis report' page.
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 110

Class

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

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

protected function assertUpgradePaths(WebAssert $session, array $available_paths, array $missing_paths) {

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

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

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