diff --git a/composer.json b/composer.json index d14d0e4..e604a2d 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ }, "require": { "ext-curl": "*", - "php": ">=7.3", + "php": "^7.3||^8", "php-curl-class/php-curl-class": "^8.6" }, "require-dev": { diff --git a/tests/IpIntel/IpIntelTest.php b/tests/IpIntel/IpIntelTest.php index 37da101..14c8e69 100644 --- a/tests/IpIntel/IpIntelTest.php +++ b/tests/IpIntel/IpIntelTest.php @@ -108,4 +108,28 @@ public function testValidateThrowsExceptionOnServiceError(): void $this->ipIntel->validate($ip, 0.2); } + + public function testValidateThrowsExceptionOnEmptyResponse(): void + { + $this->expectException(ServiceException::class); + + $ip = '666.42.33.21'; + + $this->curl->shouldReceive('setTimeout') + ->with(5) + ->once(); + + $this->curl->shouldReceive('get') + ->with( + 'https://check.getipintel.net/check.php', + [ + 'ip' => $ip, + 'contact' => $this->contactEmailAddress + ] + ) + ->once() + ->andReturnNull(); + + $this->ipIntel->validate($ip, 0.2); + } }