function MigrateSqlIdMapTest::idMapDefaults

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::idMapDefaults()
  2. 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::idMapDefaults()
  3. 10 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
8 calls to MigrateSqlIdMapTest::idMapDefaults()
MigrateSqlIdMapTest::doTestLookupSourceIdMapping in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Performs the source ID test on source and destination fields.
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.

... See full list

File

core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php, line 137

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.