public function MigrateSqlIdMapTest::testIterators in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 779 - Contains \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest.
Class
- MigrateSqlIdMapTest
- Tests the SQL ID map plugin.
Namespace
Drupal\Tests\migrate\UnitCode
public function testIterators() {
for ($i = 0; $i < 3; $i++) {
$row = $this
->idMapDefaults();
$row['sourceid1'] = "source_id_value_{$i}";
$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);
}