MDL-56331 tests: increase tolerance of coordinate tests

1) It seems the maxmind database is getting relatively frequent updates
which are causing differences in exact coordinates

2) GeoIP location lookups are not an exact science, I tried to pick some
ips which I thought would remain fairly static, but these things are
just guesses.

3) Moving to 2 decimal places should give us good enough results for
this test, according to:
http://gis.stackexchange.com/questions/8650/measuring-accuracy-of-latitude-and-longitude

  "The second decimal place is worth up to 1.1 km: it can separate one
   village from the next."
  "The third decimal place is worth up to 110 m: it can identify a
   large agricultural field or institutional campus."
This commit is contained in:
Dan Poltawski 2016-10-10 08:58:36 +01:00
parent d9520bc04e
commit 0b73876317

View File

@ -86,8 +86,8 @@ class core_iplookup_geoip_testcase extends advanced_testcase {
$this->assertEquals('array', gettype($result));
$this->assertEquals('Cambridge', $result['city']);
$this->assertEquals(0.1249, $result['longitude'], '', 0.001);
$this->assertEquals(52.191000000000003, $result['latitude'], '', 0.001);
$this->assertEquals(0.1249, $result['longitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertEquals(52.191000000000003, $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]);
@ -100,8 +100,8 @@ class core_iplookup_geoip_testcase extends advanced_testcase {
$this->assertEquals('array', gettype($result));
$this->assertEquals('Lancaster', $result['city']);
$this->assertEquals(-2.79970, $result['longitude'], '', 0.001);
$this->assertEquals(54.04650, $result['latitude'], '', 0.001);
$this->assertEquals(-2.79970, $result['longitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertEquals(54.04650, $result['latitude'], 'Coordinates are out of accepted tolerance', 0.01);
$this->assertNull($result['error']);
$this->assertEquals('array', gettype($result['title']));
$this->assertEquals('Lancaster', $result['title'][0]);