Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit fcf7fa0

Browse files
committed
Add test for response empty case
1 parent 34a98fc commit fcf7fa0

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"require": {
1111
"ext-curl": "*",
12-
"php": ">=7.3",
12+
"php": "^7.3||^8",
1313
"php-curl-class/php-curl-class": "^8.6"
1414
},
1515
"require-dev": {

tests/IpIntel/IpIntelTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,28 @@ public function testValidateThrowsExceptionOnServiceError(): void
108108

109109
$this->ipIntel->validate($ip, 0.2);
110110
}
111+
112+
public function testValidateThrowsExceptionOnEmptyResponse(): void
113+
{
114+
$this->expectException(ServiceException::class);
115+
116+
$ip = '666.42.33.21';
117+
118+
$this->curl->shouldReceive('setTimeout')
119+
->with(5)
120+
->once();
121+
122+
$this->curl->shouldReceive('get')
123+
->with(
124+
'https://check.getipintel.net/check.php',
125+
[
126+
'ip' => $ip,
127+
'contact' => $this->contactEmailAddress
128+
]
129+
)
130+
->once()
131+
->andReturnNull();
132+
133+
$this->ipIntel->validate($ip, 0.2);
134+
}
111135
}

0 commit comments

Comments
 (0)