chore: add test

This commit is contained in:
Björn Fromme
2026-04-03 15:24:56 +02:00
parent 7eb1cbdabd
commit 803b0608cc
+34
View File
@@ -290,6 +290,40 @@ class TravelDataServiceTest extends TestCase
], $result);
}
public function testGenerateFilesMapIsMemoizedWithinRequest(): void
{
$dateId = 12345;
$hotelId = 67890;
$mapping = [
$dateId => [
'id' => $dateId,
'hotels' => [
$hotelId => ['id' => $hotelId, 'name' => 'Test Hotel'],
],
],
];
// Both existsLocally() calls go through generateFilesMap(); the underlying
// loader and snapshot service must each be invoked only once.
$this->travelSnapshotService
->expects($this->exactly(2))
->method('exists')
->willReturn(false);
$this->travelLoader
->expects($this->once())
->method('generateFilesMap')
->willReturn($mapping);
$this->travelSnapshotService
->expects($this->once())
->method('generateMapping')
->willReturn([]);
$this->service->existsLocally($dateId, $hotelId);
$this->service->existsLocally($dateId, $hotelId);
}
public function testGetTravelDataFromLocalPrefersSnapshot(): void
{
$dateId = 12345;