feat: delete orphaned future snapshots after xml sync
This commit is contained in:
@@ -450,6 +450,41 @@ class TravelSnapshotServiceTest extends TestCase
|
||||
$this->assertSame(['processed' => 0, 'updated' => 0, 'failed' => 0], $result);
|
||||
}
|
||||
|
||||
public function testPurgeOrphanedFutureSnapshotsReturnsZeroForEmptyList(): void
|
||||
{
|
||||
$this->snapshotRepository
|
||||
->expects($this->once())
|
||||
->method('deleteOrphanedFutureSnapshots')
|
||||
->with([], $this->isInstanceOf(\DateTimeImmutable::class))
|
||||
->willReturn(0);
|
||||
|
||||
$result = $this->service->purgeOrphanedFutureSnapshots([]);
|
||||
|
||||
$this->assertSame(0, $result);
|
||||
}
|
||||
|
||||
public function testPurgeOrphanedFutureSnapshotsDelegatesWithCorrectArguments(): void
|
||||
{
|
||||
$activeIds = [100, 200, 300];
|
||||
|
||||
$this->snapshotRepository
|
||||
->expects($this->once())
|
||||
->method('deleteOrphanedFutureSnapshots')
|
||||
->with(
|
||||
$activeIds,
|
||||
$this->callback(function (\DateTimeImmutable $date) {
|
||||
$expected = new \DateTimeImmutable('today');
|
||||
|
||||
return abs($date->getTimestamp() - $expected->getTimestamp()) < 5;
|
||||
})
|
||||
)
|
||||
->willReturn(3);
|
||||
|
||||
$result = $this->service->purgeOrphanedFutureSnapshots($activeIds);
|
||||
|
||||
$this->assertSame(3, $result);
|
||||
}
|
||||
|
||||
public function testGenerateMappingBuildsCorrectStructure(): void
|
||||
{
|
||||
$hotel = new Hotel();
|
||||
|
||||
Reference in New Issue
Block a user