'http://monitor', 'portal-monitor.api_key' => 'k']); Http::fake(['monitor/*' => Http::response(['data' => [ ['timestamp' => '2026-10-27T00:00:10Z', 'cpu_usage_percent' => 10, 'guest_memory_usage_percent' => 40], ['timestamp' => '2026-10-27T00:00:20Z', 'cpu_usage_percent' => 30, 'guest_memory_usage_percent' => null], ['timestamp' => '2026-10-27T00:30:00Z', 'cpu_usage_percent' => 50], ]])]); $points = app(VmMetricsService::class)->history( 'vm-1', new \DateTimeImmutable('2026-10-27T00:00:00Z'), new \DateTimeImmutable('2026-10-27T01:00:00Z'), maxPoints: 4, ); $this->assertCount(2, $points); $this->assertSame(20.0, $points[0]['cpu']); $this->assertSame(40.0, $points[0]['mem']); $this->assertNull($points[1]['mem']); } }