*/ private function daily(): array { return json_decode((string) file_get_contents(__DIR__ . '/fixtures/forecast.json'), true)['daily']; } public function testIncludesTodayAndReturnsSixDays(): void { $f = ForecastMapper::map($this->daily()); self::assertCount(6, $f); self::assertSame([ 'date' => '2026-09-11', 'weather_code' => 3, 'temp_max' => 17.9, 'temp_min' => 11.0, 'precip_mm' => 0.0, 'precip_prob' => 10, ], $f[0]); self::assertSame('2026-09-16', $f[5]['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[3]['weather_code']); self::assertNull($f[3]['precip_prob']); self::assertSame(17.4, $f[3]['temp_max']); } public function testShorterResponseGivesFewerDays(): void { $daily = $this->daily(); foreach ($daily as $key => $values) { $daily[$key] = array_slice($values, 0, 3); } self::assertCount(3, ForecastMapper::map($daily)); } public function testMissingTimeArrayGivesEmptyList(): void { self::assertSame([], ForecastMapper::map([])); } }