function MigrateSqlIdMapTest::testUpdateCount
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testUpdateCount()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testUpdateCount()
- 10 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 815
Class
- MigrateSqlIdMapTest
- Tests the SQL ID map plugin.
Namespace
Drupal\Tests\migrate\UnitCode
public function testUpdateCount($num_update_rows) : void {
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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.