Skip to content

Commit 984d85c

Browse files
author
pulkit
committed
added test
1 parent ef2376e commit 984d85c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/GeoIPTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ public function test_get_random_ipaddress()
112112
$this->assertTrue(!(filter_var($ip, FILTER_VALIDATE_IP)) === False);
113113
}
114114

115+
public function test_get_non_random_ipaddress()
116+
{
117+
$config = [
118+
'driver' => 'ip-api',
119+
'random' => false,
120+
];
121+
122+
$geoip = new \PulkitJalan\GeoIP\GeoIP($config);
123+
$ip = $geoip->getIp();
124+
125+
$this->assertEquals($ip, $this->invalidIp);
126+
$this->assertTrue(!(filter_var($ip, FILTER_VALIDATE_IP)) === False);
127+
}
128+
115129
public function test_maxmind_database()
116130
{
117131
$config = [

0 commit comments

Comments
 (0)