diff --git a/tests/CartesianTest.php b/tests/CartesianTest.php index 693a7ecf2..649cd08b5 100644 --- a/tests/CartesianTest.php +++ b/tests/CartesianTest.php @@ -22,6 +22,20 @@ public function testHelmertOSWorkedExample() self::assertEquals(3909460.068, round($c->getX(), 3)); self::assertEquals(-146987.302, round($c->getY(), 3)); self::assertEquals(5019888.070, round($c->getZ(), 3)); - } + } + + public function testToString() { + $c = new Cartesian(1,2,3, RefEll::wgs84()); + + self::assertEquals('(1, 2, 3)', $c->__toString()); + } + + public function testGetters() { + $c = new Cartesian(1,2,3, RefEll::wgs84()); + self::assertEquals(1, $c->getX()); + self::assertEquals(2, $c->getY()); + self::assertEquals(3, $c->getZ()); + self::assertEquals(RefEll::wgs84(), $c->getRefEll()); + } } diff --git a/tests/LatLngTest.php b/tests/LatLngTest.php index fa53a892c..ac3c9e07d 100644 --- a/tests/LatLngTest.php +++ b/tests/LatLngTest.php @@ -90,10 +90,30 @@ public function testWGS84ToNAD27() public function testNAD27ToWGS84() { - $LatLng = new LatLng(12.3, 12.3, 0, RefEll::clarke1866()); + $LatLng = new LatLng(12.29939, 12.29855, 0, RefEll::clarke1866()); $LatLng->toWGS84(); - $expected = "(12.30061, 12.30145)"; + $expected = "(12.3, 12.3)"; + self::assertEquals($expected, $LatLng->__toString()); + } + + public function testWGS84ToIreland75() + { + + $LatLng = new LatLng(12.3, 12.3, 0, RefEll::wgs84()); + $LatLng->toIreland1975(); + + $expected = "(12.29557, 12.30201)"; + self::assertEquals($expected, $LatLng->__toString()); + } + + public function testIreland75ToWGS84() + { + + $LatLng = new LatLng(12.29557, 12.30201, 0, RefEll::airyModified()); + $LatLng->toWGS84(); + + $expected = "(12.3, 12.3)"; self::assertEquals($expected, $LatLng->__toString()); } diff --git a/tests/OSRefTest.php b/tests/OSRefTest.php index f9ca236dd..8a4bd44e9 100644 --- a/tests/OSRefTest.php +++ b/tests/OSRefTest.php @@ -132,8 +132,14 @@ public function testIssue7() { self::assertEquals(52.06186, $osLatLng->getLat()); self::assertEquals(-3.13916, $osLatLng->getLng()); + } - + public function testGetters() { + $osRef = new OSRef(100000, 200000, 123); + self::assertEquals(100000, $osRef->getX()); + self::assertEquals(200000, $osRef->getY()); + self::assertEquals(123, $osRef->getH()); + self::assertEquals(RefEll::airy1830(), $osRef->getRefEll()); } }