public function testGivenCoordinateAndRadius_parserReturnsCircle() { $parser = new CircleParser(); $circle = $parser->parse('57.421,23.90625:32684.605182'); $this->assertInstanceOf('Maps\\Elements\\Circle', $circle); $expectedLatLong = new LatLongValue(57.421, 23.90625); $this->assertTrue($expectedLatLong->equals($circle->getCircleCentre())); $this->assertEquals(32684.605182, $circle->getCircleRadius()); }
/** * @since 3.0 * * @param LatLongValue $rectangleNorthEast * @param LatLongValue $rectangleSouthWest * * @throws InvalidArgumentException */ public function __construct(LatLongValue $rectangleNorthEast, LatLongValue $rectangleSouthWest) { if ($rectangleNorthEast->equals($rectangleSouthWest)) { throw new InvalidArgumentException('$rectangleNorthEast cannot be equal to $rectangleSouthWest'); } parent::__construct(); // TODO: validate bounds are correct, if not, flip $this->setRectangleNorthEast($rectangleNorthEast); $this->setRectangleSouthWest($rectangleSouthWest); }
public function testGivenBoundingBox_parserReturnsRectangle() { $parser = new RectangleParser(); $rectangle = $parser->parse('51.8357775,33.83789:46,23.37890625'); $this->assertInstanceOf('Maps\\Elements\\Rectangle', $rectangle); $expectedNorthEast = new LatLongValue(51.8357775, 33.83789); $this->assertTrue($expectedNorthEast->equals($rectangle->getRectangleNorthEast())); $expectedSouthWest = new LatLongValue(46, 23.37890625); $this->assertTrue($expectedSouthWest->equals($rectangle->getRectangleSouthWest())); }
/** * @dataProvider latLongValueProvider */ public function testGivenLatLongInConstructor_getCoordinatesReturnsIt(LatLongValue $latLong) { $location = new Location($latLong); $this->assertTrue($latLong->equals($location->getCoordinates())); }