feat: refresh existing snapshots from XML after sync

This commit is contained in:
Björn Fromme
2026-03-24 11:13:11 +01:00
parent 909e8a1d8e
commit 3b6ee90a7e
9 changed files with 289 additions and 22 deletions
+26 -3
View File
@@ -336,7 +336,7 @@ class TravelSnapshotServiceTest extends TestCase
->expects($this->once())
->method('flush');
$result = $this->service->refreshExtendedSnapshots();
$result = $this->service->refreshExtendedSnapshots(500, false, 360, []);
$this->assertSame(['processed' => 1, 'updated' => 1, 'failed' => 0], $result);
}
@@ -374,7 +374,7 @@ class TravelSnapshotServiceTest extends TestCase
->expects($this->never())
->method('flush');
$result = $this->service->refreshExtendedSnapshots();
$result = $this->service->refreshExtendedSnapshots(500, false, 360, []);
$this->assertSame(['processed' => 1, 'updated' => 0, 'failed' => 1], $result);
}
@@ -403,11 +403,34 @@ class TravelSnapshotServiceTest extends TestCase
->expects($this->never())
->method('flush');
$result = $this->service->refreshExtendedSnapshots();
$result = $this->service->refreshExtendedSnapshots(500, false, 360, []);
$this->assertSame(['processed' => 1, 'updated' => 0, 'failed' => 1], $result);
}
public function testRefreshSkipsAllCandidatesWhenXmlDateIdsIsNull(): void
{
$payload = '{"id":100}';
$snapshot = new TravelSnapshot(100, 200, $payload, hash('sha256', $payload));
$this->snapshotRepository
->expects($this->once())
->method('findRefreshCandidates')
->willReturn([$snapshot]);
$this->apiClient
->expects($this->never())
->method('getAvailabilitiesExtended');
$this->entityManager
->expects($this->never())
->method('flush');
$result = $this->service->refreshExtendedSnapshots(500, false, 360, null);
$this->assertSame(['processed' => 0, 'updated' => 0, 'failed' => 0], $result);
}
public function testRefreshSkipsSnapshotsWithXmlAvailable(): void
{
$payload = '{"id":100}';