Permalink
Browse files

Merge branch 'MDL-61169-34' of git://github.com/andrewnicols/moodle i…

…nto MOODLE_34_STABLE
  • Loading branch information...
dmonllao committed Jan 8, 2018
2 parents 844eae5 + f83fc14 commit 6beb56ba1fc129b5b4dc84d0c138dcb59cfe8f45
Showing with 13 additions and 15 deletions.
  1. +6 −8 iplookup/tests/geoip_test.php
  2. +7 −7 iplookup/tests/geoplugin_test.php
@@ -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() {
@@ -110,4 +109,3 @@ public function test_ipv6() {
$this->assertEquals('United States', $result['title'][1]);
}
}
@@ -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() {

0 comments on commit 6beb56b

Please sign in to comment.