protected function MigrateTestBase::prepareMigrations in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/migrate/src/Tests/MigrateTestBase.php \Drupal\migrate\Tests\MigrateTestBase::prepareMigrations()
Prepare any dependent migrations.
Parameters
array $id_mappings: A list of id mappings keyed by migration ids. Each id mapping is a list of two arrays, the first are source ids and the second are destination ids.
2 calls to MigrateTestBase::prepareMigrations()
- MigrateCommentTest::setUp in core/
modules/ comment/ src/ Tests/ Migrate/ d7/ MigrateCommentTest.php - Performs setup tasks before each individual test method is run.
- MigrateUploadTest::setUp in core/
modules/ file/ src/ Tests/ Migrate/ d6/ MigrateUploadTest.php - Performs setup tasks before each individual test method is run.
File
- core/
modules/ migrate/ src/ Tests/ MigrateTestBase.php, line 130 - Contains \Drupal\migrate\Tests\MigrateTestBase.
Class
- MigrateTestBase
- Base class for migration tests.
Namespace
Drupal\migrate\TestsCode
protected function prepareMigrations(array $id_mappings) {
foreach ($id_mappings as $migration_id => $data) {
// Use loadMultiple() here in order to load all variants.
foreach (Migration::loadMultiple([
$migration_id,
]) as $migration) {
$id_map = $migration
->getIdMap();
$id_map
->setMessage($this);
$source_ids = $migration
->getSourcePlugin()
->getIds();
foreach ($data as $id_mapping) {
$row = new Row(array_combine(array_keys($source_ids), $id_mapping[0]), $source_ids);
$id_map
->saveIdMapping($row, $id_mapping[1]);
}
}
}
}