function MigrateDrupal6AuditIdsTest::testMultipleMigrationWithoutIdConflicts
Same name in other branches
- 9 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testMultipleMigrationWithoutIdConflicts()
- 10 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testMultipleMigrationWithoutIdConflicts()
- 11.x core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testMultipleMigrationWithoutIdConflicts()
Tests multiple migrations to the same destination with no ID conflicts.
File
-
core/
modules/ migrate_drupal/ tests/ src/ Kernel/ d6/ MigrateDrupal6AuditIdsTest.php, line 59
Class
- MigrateDrupal6AuditIdsTest
- Tests the migration auditor for ID conflicts.
Namespace
Drupal\Tests\migrate_drupal\Kernel\d6Code
public function testMultipleMigrationWithoutIdConflicts() {
// Create a node of type page.
$node = Node::create([
'type' => 'page',
'title' => 'foo',
]);
$node->moderation_state->value = 'published';
$node->save();
// Insert data in the d6_node:page migration mapping table to simulate a
// previously migrated node.
$id_map = $this->getMigration('d6_node:page')
->getIdMap();
$table_name = $id_map->mapTableName();
$id_map->getDatabase()
->insert($table_name)
->fields([
'source_ids_hash' => 1,
'sourceid1' => 1,
'destid1' => 1,
])
->execute();
// Audit the IDs of the d6_node migrations for the page & article node type.
// There should be no conflicts since the highest destination ID should be
// equal to the highest migrated ID, as found in the aggregated mapping
// tables of the two node migrations.
$migrations = [
$this->getMigration('d6_node:page'),
$this->getMigration('d6_node:article'),
];
$results = (new IdAuditor())->auditMultiple($migrations);
/** @var \Drupal\migrate\Audit\AuditResult $result */
foreach ($results as $result) {
$this->assertInstanceOf(AuditResult::class, $result);
$this->assertTrue($result->passed());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.