diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php index 36925d2b84..eb3ff13cd9 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php @@ -108,6 +108,7 @@ public function testMigrateUpgradeExecute() { $this->drupalPostForm(NULL, [], t('Perform upgrade')); $this->assertText(t('Congratulations, you upgraded Drupal!')); $this->assertMigrationResults($this->getEntityCounts(), $version); + $this->assertFollowUpMigrationResults($this->getFollowUpMigrationExpectedResults()); \Drupal::service('module_installer')->install(['forum']); \Drupal::service('module_installer')->install(['book']); diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php index c09b7ca723..45598dfa9b 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php @@ -166,6 +166,14 @@ protected function assertUpgradePaths(WebAssert $session, array $available_paths abstract protected function getEntityCountsIncremental(); /** + * Gets expected number of results per follow-up migrations. + * + * @return int[] + * An array of expected counts keyed by migration ID. + */ + abstract protected function getFollowUpMigrationExpectedResults(); + + /** * Helper method to assert the text on the 'Upgrade analysis report' page. * * @param \Drupal\Tests\WebAssert $session @@ -260,4 +268,19 @@ protected function assertMigrationResults(array $expected_counts, $version) { } } + /** + * Checks that follow-up migrations have been performed successfully. + * + * @param array $expected_results + * The follow-up migrations expected results. + */ + protected function assertFollowUpMigrationResults(array $expected_results) { + $plugin_manager = $this->container->get('plugin.manager.migration'); + foreach ($expected_results as $migration_id => $expected_result) { + /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */ + $migration = $plugin_manager->createInstance($migration_id); + $this->assertSame($migration->getIdMap()->importedCount(), $expected_result); + } + } + } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php index 62c54cc0c4..c86f2377e5 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php @@ -183,6 +183,15 @@ protected function getMissingPaths() { } /** + * {@inheritdoc} + */ + protected function getFollowUpMigrationExpectedResults() { + return [ + 'd6_entity_reference_translation:node__page' => 4, + ]; + } + + /** * Executes all steps of migrations upgrade. */ public function testMigrateUpgradeExecute() { diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php index 72ce58fe55..c9130b2240 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php @@ -181,6 +181,15 @@ protected function getMissingPaths() { } /** + * {@inheritdoc} + */ + protected function getFollowUpMigrationExpectedResults() { + return [ + 'd7_entity_reference_translation:node__article' => 2, + ]; + } + + /** * Executes all steps of migrations upgrade. */ public function testMigrateUpgradeExecute() {