Skip to content

Commit

Permalink
MDL-61169 iplookup: Change to github.com IP
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jan 8, 2018
1 parent 013f0b2 commit 2cf6b06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
14 changes: 6 additions & 8 deletions iplookup/tests/geoip_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,16 @@ public function setUp() {
}

public function test_ipv4() {

$result = iplookup_find_location('131.111.150.25');
$result = iplookup_find_location('192.30.255.112');

$this->assertEquals('array', gettype($result));
$this->assertEquals('Cambridge', $result['city']);
$this->assertEquals(0.1167, $result['longitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertEquals(52.2, $result['latitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertEquals('San Francisco', $result['city']);
$this->assertEquals(-122.3933, $result['longitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertEquals(37.7697, $result['latitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertNull($result['error']);
$this->assertEquals('array', gettype($result['title']));
$this->assertEquals('Cambridge', $result['title'][0]);
$this->assertEquals('United Kingdom', $result['title'][1]);
$this->assertEquals('San Francisco', $result['title'][0]);
$this->assertEquals('United States', $result['title'][1]);
}

public function test_ipv6() {
Expand All @@ -110,4 +109,3 @@ public function test_ipv6() {
$this->assertEquals('United States', $result['title'][1]);
}
}

14 changes: 7 additions & 7 deletions iplookup/tests/geoplugin_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ public function setUp() {
$CFG->geoipfile = '';
}

public function test_geoip_ipv4() {
$result = iplookup_find_location('131.111.150.25');
public function test_ipv4() {
$result = iplookup_find_location('192.30.255.112');

$this->assertEquals('array', gettype($result));
$this->assertEquals('Cambridge', $result['city']);
$this->assertEquals(0.1167, $result['longitude'], '', 0.001);
$this->assertEquals(52.200000000000003, $result['latitude'], '', 0.001);
$this->assertEquals('San Francisco', $result['city']);
$this->assertEquals(-122.3933, $result['longitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertEquals(37.7697, $result['latitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertNull($result['error']);
$this->assertEquals('array', gettype($result['title']));
$this->assertEquals('Cambridge', $result['title'][0]);
$this->assertEquals('United Kingdom', $result['title'][1]);
$this->assertEquals('San Francisco', $result['title'][0]);
$this->assertEquals('United States', $result['title'][1]);
}

public function test_geoip_ipv6() {
Expand Down

0 comments on commit 2cf6b06

Please sign in to comment.