protected function MigrateNodeTest::rerunMigration in Drupal 9
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeTest::rerunMigration()
Execute the migration a second time.
Parameters
array $new_row: An optional row to be inserted into the id map.
Return value
string The new title in the source for vid 3.
1 call to MigrateNodeTest::rerunMigration()
- MigrateNodeTest::testNode in core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d6/ MigrateNodeTest.php - Tests node migration from Drupal 6 to 8.
File
- core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d6/ MigrateNodeTest.php, line 233
Class
- MigrateNodeTest
- Node content migration.
Namespace
Drupal\Tests\node\Kernel\Migrate\d6Code
protected function rerunMigration($new_row = []) {
$title = $this
->randomString();
$source_connection = Database::getConnection('default', 'migrate');
$source_connection
->update('node_revisions')
->fields([
'title' => $title,
'format' => 2,
])
->condition('vid', 3)
->execute();
$migration = $this
->getMigration('d6_node:story');
$table_name = $migration
->getIdMap()
->mapTableName();
$default_connection = \Drupal::database();
$default_connection
->truncate($table_name)
->execute();
if ($new_row) {
$hash = $migration
->getIdMap()
->getSourceIdsHash([
'nid' => $new_row['sourceid1'],
]);
$new_row['source_ids_hash'] = $hash;
$default_connection
->insert($table_name)
->fields($new_row)
->execute();
}
$this
->executeMigration($migration);
return $title;
}