protected function MigrateMediaTestBase::assertMediaMigrationResults in Media Migration 8
Checks that migrations have been performed successfully.
4 calls to MigrateMediaTestBase::assertMediaMigrationResults()
- MigrateEmbedMediaTokenToEntityEmbedTest::testMediaTokenToEntityEmbedTransform in tests/
src/ Functional/ MigrateEmbedMediaTokenToEntityEmbedTest.php - Tests the result of Media Migration's embed media token transform.
- MigrateEmbedMediaTokenToMediaEmbedTest::testMediaTokenToMediaEmbedTransform in tests/
src/ Functional/ MigrateEmbedMediaTokenToMediaEmbedTest.php - Tests the result of Media Migration's embed media token transform.
- MigrateMediaFromNonMediaSourceTest::testPlainFileToMediaMigration in tests/
src/ Functional/ MigrateMediaFromNonMediaSourceTest.php - Tests the result of the media migration.
- MigrateMediaTest::testMediaMigrate in tests/
src/ Functional/ MigrateMediaTest.php - Tests the result of the media migration.
File
- tests/
src/ Functional/ MigrateMediaTestBase.php, line 511
Class
- MigrateMediaTestBase
- Provides a base class for testing media migration via the UI.
Namespace
Drupal\Tests\media_migration\FunctionalCode
protected function assertMediaMigrationResults() {
$version = $this
->getLegacyDrupalVersion($this->sourceDatabase);
$this
->assertEntities();
$plugin_manager = $this->container
->get('plugin.manager.migration');
/** @var \Drupal\migrate\Plugin\Migration[] $all_migrations */
$all_migrations = $plugin_manager
->createInstancesByTag('Drupal ' . $version);
foreach ($all_migrations as $migration) {
$id_map = $migration
->getIdMap();
foreach ($id_map as $source_id => $map) {
// Convert $source_id into a keyless array so that
// \Drupal\migrate\Plugin\migrate\id_map\Sql::getSourceHash() works as
// expected.
$source_id_values = array_values(unserialize($source_id));
$row = $id_map
->getRowBySource($source_id_values);
$destination = serialize($id_map
->currentDestination());
$message = "Migration of {$source_id} to {$destination} as part of the {$migration->id()} migration. The source row status is " . $row['source_row_status'];
// A completed migration should have maps with
// MigrateIdMapInterface::STATUS_IGNORED or
// MigrateIdMapInterface::STATUS_IMPORTED.
$this
->assertNotSame(MigrateIdMapInterface::STATUS_FAILED, $row['source_row_status'], $message);
$this
->assertNotSame(MigrateIdMapInterface::STATUS_NEEDS_UPDATE, $row['source_row_status'], $message);
}
}
}