Http::response([ 'status' => 'success', 'country' => 'United States', 'regionName' => 'Virginia', 'city' => 'Ashburn', 'isp' => 'Google LLC', 'org' => 'Google Public DNS', 'query' => '8.8.8.8', ]), ]); $target = new Target(['type' => 'ip', 'value' => '8.8.8.8']); $result = (new IpApiRunner)->run($target); $this->assertSame('Ashburn, Virginia, United States (Google LLC)', $result->summary); $this->assertSame('8.8.8.8', $result->raw['query']); } public function test_throws_when_lookup_reports_failure(): void { Http::fake([ 'ip-api.com/*' => Http::response([ 'status' => 'fail', 'message' => 'private range', 'query' => '10.0.0.1', ]), ]); $target = new Target(['type' => 'ip', 'value' => '10.0.0.1']); $this->expectException(RunnerException::class); $this->expectExceptionMessage('private range'); (new IpApiRunner)->run($target); } public function test_rejects_non_ip_targets(): void { $target = new Target(['type' => 'domain', 'value' => 'example.com']); $this->expectException(RunnerException::class); (new IpApiRunner)->run($target); } }