Skip to content

Commit

Permalink
Merge pull request #173 from dragosprotung/testSolidPolygonFromArrayO…
Browse files Browse the repository at this point in the history
…fPoints

Added test for polygon from array of points
  • Loading branch information
sadortun authored Jan 10, 2017
2 parents f354743 + 404aadf commit 7211e90
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,32 @@ public function testSolidPolygonFromObjectsToArray()
$this->assertEquals($expected, $polygon->toArray());
}

public function testSolidPolygonFromArrayOfPoints()
{
$expected = array(
array(
array(0, 0),
array(10, 0),
array(10, 10),
array(0, 10),
array(0, 0)
)
);
$rings = array(
array(
new Point(0, 0),
new Point(10, 0),
new Point(10, 10),
new Point(0, 10),
new Point(0, 0)
)
);

$polygon = new Polygon($rings);

$this->assertEquals($expected, $polygon->toArray());
}

public function testSolidPolygonFromArraysGetRings()
{
$expected = array(
Expand Down Expand Up @@ -238,7 +264,7 @@ public function testSolidPolygonFromArraysToString()
)
);
$polygon = new Polygon($rings);
$result = (string) $polygon;
$result = (string)$polygon;

$this->assertEquals($expected, $result);
}
Expand Down

0 comments on commit 7211e90

Please sign in to comment.