function MigrateSqlIdMapTest::saveMap
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::saveMap()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::saveMap()
- 10 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::saveMap()
Saves a single ID mapping row in the database.
Parameters
array $map: The row to save.
9 calls to MigrateSqlIdMapTest::saveMap()
- MigrateSqlIdMapTest::doTestLookupSourceIdMapping in core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php - Performs the source ID test on source and destination fields.
- MigrateSqlIdMapTest::setupRows in core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php - Setup a database with the given rows.
- MigrateSqlIdMapTest::testErrorCount in core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php - Performs error count test with a given number of error rows.
- MigrateSqlIdMapTest::testGetHighestId in core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php - Tests getHighestId method.
- MigrateSqlIdMapTest::testGetRowByDestination in core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php - Tests the getRowByDestination method.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php, line 73
Class
- MigrateSqlIdMapTest
- Tests the SQL ID map plugin.
Namespace
Drupal\Tests\migrate\UnitCode
protected function saveMap(array $map) : void {
$table = 'migrate_map_sql_idmap_test';
$schema = $this->database
->schema();
// If the table already exists, add any columns which are in the map array,
// but don't yet exist in the table. Yay, flexibility!
if ($schema->tableExists($table)) {
foreach (array_keys($map) as $field) {
if (!$schema->fieldExists($table, $field)) {
$schema->addField($table, $field, [
'type' => 'text',
]);
}
}
}
else {
$schema->createTable($table, $this->createSchemaFromRow($map));
}
$this->database
->insert($table)
->fields($map)
->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.