You are here

private function MigrateSqlIdMapTest::getIdMapContents in Drupal 10

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

Retrieves the contents of an ID map.

Return value

array The contents of an ID map.

File

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

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

private function getIdMapContents() {
  $result = $this->database
    ->select('migrate_map_sql_idmap_test', 't')
    ->fields('t')
    ->execute();

  // The return value needs to be countable, or it will fail certain
  // assertions. iterator_to_array() will not suffice because it won't
  // respect the PDO fetch mode, if specified.
  $contents = [];
  foreach ($result as $row) {
    $contents[] = (array) $row;
  }
  return $contents;
}