You are here

protected function MigrateUpgradeCommandsTest::assertMigrations in Migrate Upgrade 8.3

Asserts that all migrations are exported as migrate_plus entities.

Parameters

string $prefix: The migration id prefix.

\Drupal\migrate\Plugin\MigrationInterface[] $migrations: The migrations.

\Drupal\migrate_plus\Entity\MigrationInterface[] $migrate_plus_migrations: The migrate plus config entities.

1 call to MigrateUpgradeCommandsTest::assertMigrations()
MigrateUpgradeCommandsTest::testDrupalConfigureUpgrade in tests/src/Functional/MigrateUpgradeCommandsTest.php
Test module using Drupal fixture.

File

tests/src/Functional/MigrateUpgradeCommandsTest.php, line 119

Class

MigrateUpgradeCommandsTest
Execute drush on fully functional website.

Namespace

Drupal\Tests\migrate_upgrade\Functional

Code

protected function assertMigrations($prefix, array $migrations, array $migrate_plus_migrations) : void {

  // This filters to remove duplicate migrations that have an embedded data
  // source and therefore are always available.
  $available_migrations = array_flip(array_map(static function (MigrationInterface $migration) use ($prefix) {
    if (strpos($migration
      ->id(), $prefix) === 0) {
      return $migration
        ->id();
    }
    return $prefix . str_replace(PluginBase::DERIVATIVE_SEPARATOR, '_', $migration
      ->id());
  }, $migrations));
  $this
    ->assertEmpty(array_diff_key($available_migrations, $migrate_plus_migrations));
}