protected function MigrateUpgradeEckTest::assertReviewForm in Entity Construction Kit (ECK) 8
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
1 call to MigrateUpgradeEckTest::assertReviewForm()
- MigrateUpgradeEckTest::testMigrateUpgrade in tests/
src/ Functional/ MigrateUpgradeEckTest.php - Tests the migrate upgrade review form and upgrade process.
File
- tests/
src/ Functional/ MigrateUpgradeEckTest.php, line 166
Class
- MigrateUpgradeEckTest
- Tests ECK upgrade using the migrate UI.
Namespace
Drupal\Tests\eck\FunctionalCode
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 $machine_name => $label) {
$session
->elementExists('xpath', $this
->getReviewFormXpath("[contains(@class, 'checked') and (text() = '{$machine_name}' or text() = '{$label}')]"));
$session
->elementNotExists('xpath', $this
->getReviewFormXpath("[contains(@class, 'error') and (text() = '{$machine_name}' or text() = '{$label}')]"));
}
// Test the missing migration paths.
foreach ($missing_paths as $machine_name => $label) {
$session
->elementExists('xpath', $this
->getReviewFormXpath("[contains(@class, 'error') and (text() = '{$machine_name}' or text() = '{$label}')]"));
$session
->elementNotExists('xpath', $this
->getReviewFormXpath("[contains(@class, 'checked') and (text() = '{$machine_name}' or text() = '{$label}')]"));
}
// Test the total count of missing and available paths.
$session
->elementsCount('xpath', $this
->getReviewFormXpath("[contains(@class, 'upgrade-analysis-report__status-icon--error')]"), \count($missing_paths));
$session
->elementsCount('xpath', $this
->getReviewFormXpath("[contains(@class, 'upgrade-analysis-report__status-icon--checked')]"), \count($available_paths));
}