public function testCalculate() { $Haversine = new C\Haversine(); $point1 = new N\LatLong(new N\Coordinate(80.90000000000001), new N\Coordinate(20.1)); $point2 = new N\LatLong(new N\Coordinate(20.1), new N\Coordinate(80.90000000000001)); $metres = $Haversine->calculate($point1, $point2); $this->assertEquals(7303552.8457791, $metres, '', 0.2); }
/** * @dataProvider haversineDataProvider */ public function testHaversineCalculate($lat1, $long1, $lat2, $long2, $expected_result) { $Haversine = new C\Haversine($this->getObject()); $point1 = new N\LatLong(new N\Coordinate($lat1), new N\Coordinate($long1)); $point2 = new N\LatLong(new N\Coordinate($lat2), new N\Coordinate($long2)); $metres = $Haversine->calculate($point1, $point2); $this->assertEquals($expected_result, $metres, '', 0.2); }
/** * @expectedException PHPUnit_Framework_Error */ public function testFailedCalculator() { $Haversine = new C\Haversine(); $Haversine->calculate(new stdClass(), new stdClass()); }