Use assertEqualsWithDelta for float comparisons

PHPUnit 7.3 introduced the functions assertEqualsWithDelta for comparing
floats with a delta. The old four-argument version of assertEquals is
deprecated in PHPUnit 8 and removed in PHPUnit 9.

This commit means that the tests will fail with PHPUnit < 7.3 because
assertEqualsWithDelta is not defined there.
This commit is contained in:
Simon Will 2020-05-05 23:43:09 +02:00
parent 43fd2a7423
commit 14dba39157

View File

@ -98,8 +98,8 @@ class LibTest extends \PHPUnit\Framework\TestCase
foreach ($aQueries as $sQuery) {
$aRes = parseLatLon($sQuery);
$this->assertEquals(40.446, $aRes[1], 'degrees decimal ' . $sQuery, 0.01);
$this->assertEquals(-79.982, $aRes[2], 'degrees decimal ' . $sQuery, 0.01);
$this->assertEqualsWithDelta(40.446, $aRes[1], 0.01, 'degrees decimal ' . $sQuery);
$this->assertEqualsWithDelta(-79.982, $aRes[2], 0.01, 'degrees decimal ' . $sQuery);
$this->assertEquals($sQuery, $aRes[0]);
}
}