Skip to content

Commit

Permalink
Merge branch 'MDL-61169-master' of git://github.com/andrewnicols/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Jan 8, 2018
2 parents 7110a3e + 2cf6b06 commit 22a9fed
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
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
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 22a9fed

Please sign in to comment.