public function MigrateSqlIdMapTest::testUpdateCount in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testUpdateCount()
Performs the update count test with a given number of update rows.
@dataProvider updateCountDataProvider
Parameters
int $num_update_rows: The number of update rows to test.
File
- core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php, line 802
Class
- MigrateSqlIdMapTest
- Tests the SQL ID map plugin.
Namespace
Drupal\Tests\migrate\UnitCode
public function testUpdateCount($num_update_rows) {
for ($i = 0; $i < 5; $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;
$this
->saveMap($row);
}
for (; $i < 5 + $num_update_rows; $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_NEEDS_UPDATE;
$this
->saveMap($row);
}
$id_map = $this
->getIdMap();
$this
->assertSame($num_update_rows, $id_map
->updateCount());
}