function MigrateSqlIdMapTest::testIterators
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testIterators()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testIterators()
- 11.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testIterators()
Tests all the iterator methods in one swing.
The iterator methods are:
- Sql::rewind()
- Sql::next()
- Sql::valid()
- Sql::key()
- Sql::current()
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php, line 1030
Class
- MigrateSqlIdMapTest
- Tests the SQL ID map plugin.
Namespace
Drupal\Tests\migrate\UnitCode
public function testIterators() : void {
for ($i = 0; $i < 3; $i++) {
$row = $this->idMapDefaults();
$row['sourceid1'] = "source_id_value_{$i}";
$row['source_ids_hash'] = $this->getIdMap()
->getSourceIdsHash([
'source_id_property' => $row['sourceid1'],
]);
$row['destid1'] = "destination_id_value_{$i}";
$row['source_row_status'] = MigrateIdMapInterface::STATUS_IMPORTED;
$expected_results[serialize([
'sourceid1' => $row['sourceid1'],
])] = [
'destid1' => $row['destid1'],
];
$this->saveMap($row);
}
$this->assertSame(iterator_to_array($this->getIdMap()), $expected_results);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.