protected function MigrateSqlIdMapTest::idMapDefaults in Drupal 10
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::idMapDefaults()
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::idMapDefaults()
Sets defaults for SQL ID map plugin tests.
Return value
array An associative array with the following keys:
- source_row_status
- rollback_action
- hash
File
- core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php, line 132
Class
- MigrateSqlIdMapTest
- Tests the SQL ID map plugin.
Namespace
Drupal\Tests\migrate\UnitCode
protected function idMapDefaults() {
$defaults = [
'source_row_status' => MigrateIdMapInterface::STATUS_IMPORTED,
'rollback_action' => MigrateIdMapInterface::ROLLBACK_DELETE,
'hash' => '',
];
// By default, the PDO SQLite driver strongly prefers to return strings
// from SELECT queries. Even for columns that don't store strings. Even
// if the connection's STRINGIFY_FETCHES attribute is FALSE. This can cause
// assertSame() calls to fail, since 0 !== '0'. Casting these values to
// strings isn't the most elegant workaround, but it allows the assertions
// to pass properly.
if ($this->database
->driver() == 'sqlite') {
$defaults['source_row_status'] = (string) $defaults['source_row_status'];
$defaults['rollback_action'] = (string) $defaults['rollback_action'];
}
return $defaults;
}