*/ private function daily(): array { return json_decode((string) file_get_contents(__DIR__ . '/fixtures/forecast.json'), true)['daily']; } public function testSkipsTodayAndReturnsFiveDays(): void { $f = ForecastMapper::map($this->daily()); self::assertCount(5, $f); self::assertSame([ 'date' => '2026-09-12', 'weather_code' => 2, 'temp_max' => 18.3, 'temp_min' => 10.1, 'precip_mm' => 0.4, 'precip_prob' => 20, ], $f[0]); self::assertSame('2026-09-16', $f[4]['date']); } public function testNullValuesStayNull(): void { $daily = $this->daily(); $daily['weather_code'][3] = null; $daily['precipitation_probability_max'][3] = null; $f = ForecastMapper::map($daily); self::assertNull($f[2]['weather_code']); self::assertNull($f[2]['precip_prob']); self::assertSame(17.4, $f[2]['temp_max']); } public function testShorterResponseGivesFewerDays(): void { $daily = $this->daily(); foreach ($daily as $key => $values) { $daily[$key] = array_slice($values, 0, 3); } self::assertCount(2, ForecastMapper::map($daily)); } public function testMissingTimeArrayGivesEmptyList(): void { self::assertSame([], ForecastMapper::map([])); } }