Skiwoche '; /** * A travel may reference a hotel id that hotel.xml does not carry. Before the guard the * miss was dereferenced, which fataled the whole cached mapping rather than one entry -- * so /api/travels went down entirely, not just the affected travel. */ public function testGenerateFilesMapSkipsHotelsMissingFromMasterData(): void { $known = new Hotel(); $known->id = 1; $known->name = 'Hotel Bekannt'; $hotelLoader = $this->createStub(HotelLoader::class); $hotelLoader->method('loadAll')->willReturn([1 => $known]); $filesystem = $this->createStub(FilesystemOperator::class); $filesystem->method('listContents')->willReturn( new DirectoryListing([new FileAttributes('Ziel_1.xml')]) ); $filesystem->method('read')->willReturn(self::XML); $loader = new TravelLoader( $hotelLoader, $this->createStub(TravelParser::class), 'https://example.test', new TagAwareAdapter(new ArrayAdapter()), $filesystem, ); $mapping = $loader->generateFilesMap(); $this->assertArrayHasKey(900, $mapping); $this->assertSame([1], array_keys($mapping[900]['hotels'])); $this->assertSame('Hotel Bekannt', $mapping[900]['hotels'][1]['label']); } }