You are here

protected function MigrateSqlIdMapTest::idMapDefaults in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::idMapDefaults()

Sets defaults for SQL ID map plugin tests.

8 calls to MigrateSqlIdMapTest::idMapDefaults()
MigrateSqlIdMapTest::testErrorCount in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Performs error count test with a given number of error rows.
MigrateSqlIdMapTest::testGetRowByDestination in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests the getRowByDestination method.
MigrateSqlIdMapTest::testGetRowBySource in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests the getRowBySource method.
MigrateSqlIdMapTest::testIterators in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests all the iterator methods in one swing.
MigrateSqlIdMapTest::testLookupDestinationIdMapping in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Performs destination ID test on source and destination fields.

... See full list

File

core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php, line 118
Contains \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest.

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

protected function idMapDefaults() {
  $defaults = array(
    '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;
}