[Mapbender-commits] r7028 - in trunk/mapbender/test: data
http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Oct 5 07:44:03 EDT 2010
Author: christoph
Date: 2010-10-05 11:44:03 +0000 (Tue, 05 Oct 2010)
New Revision: 7028
Added:
trunk/mapbender/test/data/line.gml3.xml
trunk/mapbender/test/data/multipoint.gml3.xml
trunk/mapbender/test/data/multipolygon.gml3.xml
trunk/mapbender/test/data/point.gml3.xml
trunk/mapbender/test/data/polygon.gml3.xml
trunk/mapbender/test/data/polygonDonut.gml3.xml
trunk/mapbender/test/data/polygonDonutNoWhiteSpace.gml3.xml
trunk/mapbender/test/http/classes/Gml3FactoryTest.php
Log:
unit tests for gml3 factory
Added: trunk/mapbender/test/data/line.gml3.xml
===================================================================
--- trunk/mapbender/test/data/line.gml3.xml (rev 0)
+++ trunk/mapbender/test/data/line.gml3.xml 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1,2 @@
+<gml:MultiCurve srsName="EPSG:4326"><gml:curveMember><gml:LineString><gml:pos>-101.89 -20.71</gml:pos><gml:pos>-95.5 -21.93</gml:pos></gml:LineString></gml:curveMember></gml:MultiCurve>
+
Added: trunk/mapbender/test/data/multipoint.gml3.xml
===================================================================
--- trunk/mapbender/test/data/multipoint.gml3.xml (rev 0)
+++ trunk/mapbender/test/data/multipoint.gml3.xml 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1 @@
+<gml:MultiPoint srsName='EPSG:4326'><gml:pointMember><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point><gml:pointMember><gml:MultiPoint>
\ No newline at end of file
Added: trunk/mapbender/test/data/multipolygon.gml3.xml
===================================================================
--- trunk/mapbender/test/data/multipolygon.gml3.xml (rev 0)
+++ trunk/mapbender/test/data/multipolygon.gml3.xml 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1 @@
+<gml:MultiSurface srsName='EPSG:4326'><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:pos>-101.18 -22.99</gml:pos><gml:pos>-100.07 -22.15</gml:pos><gml:pos>-99.9 -23.02</gml:pos><gml:pos>-100.48 -23.5</gml:pos><gml:pos>-101.49 -23.38</gml:pos><gml:pos>-101.18 -22.99</gml:pos></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:pos>-99.37 -22.13</gml:pos><gml:pos>-99.06 -22.32</gml:pos><gml:pos>-99.49 -22.95</gml:pos><gml:pos>-99.37 -22.13</gml:pos></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>
\ No newline at end of file
Added: trunk/mapbender/test/data/point.gml3.xml
===================================================================
--- trunk/mapbender/test/data/point.gml3.xml (rev 0)
+++ trunk/mapbender/test/data/point.gml3.xml 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1 @@
+<gml:Point srsName='EPSG:4326'><gml:pos>-98.89 -18.81</gml:pos></gml:Point>
\ No newline at end of file
Added: trunk/mapbender/test/data/polygon.gml3.xml
===================================================================
--- trunk/mapbender/test/data/polygon.gml3.xml (rev 0)
+++ trunk/mapbender/test/data/polygon.gml3.xml 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1 @@
+<gml:MultiSurface srsName="EPSG:4326"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:pos>-101.18 -22.99</gml:pos> <gml:pos>-100.07 -22.15</gml:pos> <gml:pos>-99.9 -23.02</gml:pos> <gml:pos>-100.48 -23.5</gml:pos> <gml:pos>-101.49 -23.38</gml:pos> <gml:pos>-101.18 -22.99</gml:pos></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>
\ No newline at end of file
Added: trunk/mapbender/test/data/polygonDonut.gml3.xml
===================================================================
--- trunk/mapbender/test/data/polygonDonut.gml3.xml (rev 0)
+++ trunk/mapbender/test/data/polygonDonut.gml3.xml 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1 @@
+<gml:MultiSurface srsName="EPSG:4326"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:pos>-19 -70</gml:pos> <gml:pos>-7 -62</gml:pos> <gml:pos>13 -67</gml:pos> <gml:pos>3 -72</gml:pos> <gml:pos>-19 -70</gml:pos></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:pos>-7.4 -67.6</gml:pos><gml:pos>-4.8 -66.9</gml:pos><gml:pos>-6.6 -65.5</gml:pos><gml:pos>-7.4 -67.6</gml:pos></gml:LinearRing></gml:interior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>
\ No newline at end of file
Added: trunk/mapbender/test/data/polygonDonutNoWhiteSpace.gml3.xml
===================================================================
--- trunk/mapbender/test/data/polygonDonutNoWhiteSpace.gml3.xml (rev 0)
+++ trunk/mapbender/test/data/polygonDonutNoWhiteSpace.gml3.xml 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1 @@
+<gml:MultiSurface srsName="EPSG:4326"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:pos>-19 -70</gml:pos><gml:pos>-7 -62</gml:pos><gml:pos>13 -67</gml:pos><gml:pos>3 -72</gml:pos><gml:pos>-19 -70</gml:pos></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:pos>-7.4 -67.6</gml:pos><gml:pos>-4.8 -66.9</gml:pos><gml:pos>-6.6 -65.5</gml:pos><gml:pos>-7.4 -67.6</gml:pos></gml:LinearRing></gml:interior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>
\ No newline at end of file
Added: trunk/mapbender/test/http/classes/Gml3FactoryTest.php
===================================================================
--- trunk/mapbender/test/http/classes/Gml3FactoryTest.php (rev 0)
+++ trunk/mapbender/test/http/classes/Gml3FactoryTest.php 2010-10-05 11:44:03 UTC (rev 7028)
@@ -0,0 +1,128 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . "/../../../http/classes/class_gml_3_factory.php";
+
+class Gml3FactoryTest extends PHPUnit_Framework_TestCase {
+
+ protected $gml3Factory;
+ protected $geoJsonPolygonDonut;
+
+ public function setUp () {
+ $this->geoJsonPolygonDonut = dirname(__FILE__) . "/../../data/polygonDonut.json";
+ $this->gml3PolygonDonut = dirname(__FILE__) . "/../../data/polygonDonut.gml3.xml";
+ $this->geoJsonLine = dirname(__FILE__) . "/../../data/line.json";
+ $this->gml3Line = dirname(__FILE__) . "/../../data/line.gml3.xml";
+ $this->geoJsonPoint = dirname(__FILE__) . "/../../data/point.json";
+ $this->gml3Point = dirname(__FILE__) . "/../../data/point.gml3.xml";
+ $this->geoJsonPolygon = dirname(__FILE__) . "/../../data/polygon.json";
+ $this->gml3Polygon = dirname(__FILE__) . "/../../data/polygon.gml3.xml";
+ $this->geoJsonMultiPolygon = dirname(__FILE__) . "/../../data/multipolygon.json";
+ $this->gml3MultiPolygon = dirname(__FILE__) . "/../../data/multipolygon.gml3.xml";
+
+ $this->geoJsonMultiLine = dirname(__FILE__) . "/../../data/multiline.json";
+ $this->gml3MultiLine = dirname(__FILE__) . "/../../data/multiline.gml3.xml";
+
+ $this->geoJsonMultiPoint = dirname(__FILE__) . "/../../data/multipoint.json";
+ $this->gml3MultiPoint = dirname(__FILE__) . "/../../data/multipoint.gml3.xml";
+
+ $this->gml3PolygonDonutNoWhiteSpace = dirname(__FILE__) . "/../../data/polygonDonutNoWhiteSpace.gml3.xml";
+ $this->gml3Factory = new Gml_3_Factory();
+ }
+
+ public function testRemoveWhiteSpace () {
+ $gml3 = file_get_contents($this->gml3PolygonDonut);
+ $expectedGml3 = file_get_contents($this->gml3PolygonDonutNoWhiteSpace);
+ $this->assertEquals(
+ $expectedGml3,
+ $this->gml3Factory->removeWhiteSpace($gml3)
+ );
+
+ }
+
+ public function testGeoJsonToGml3PolygonDonut() {
+ $geoJson = file_get_contents($this->geoJsonPolygonDonut);
+ $expectedGml3 = file_get_contents($this->gml3PolygonDonut);
+
+ $gmlObj = $this->gml3Factory->createFromGeoJson($geoJson);
+
+ $this->assertEquals(
+ $this->gml3Factory->removeWhiteSpace($expectedGml3),
+ $gmlObj->toGml()
+ );
+ }
+
+ public function testGeoJsonToGml3Line() {
+ $geoJson = file_get_contents($this->geoJsonLine);
+ $expectedGml3 = file_get_contents($this->gml3Line);
+
+ $gmlObj = $this->gml3Factory->createFromGeoJson($geoJson);
+
+ $this->assertEquals(
+ $this->gml3Factory->removeWhiteSpace($expectedGml3),
+ $gmlObj->toGml()
+ );
+ }
+
+ public function testGeoJsonToGml3Point() {
+ $geoJson = file_get_contents($this->geoJsonPoint);
+ $expectedGml3 = file_get_contents($this->gml3Point);
+
+ $gmlObj = $this->gml3Factory->createFromGeoJson($geoJson);
+
+ $this->assertEquals(
+ $this->gml3Factory->removeWhiteSpace($expectedGml3),
+ $gmlObj->toGml()
+ );
+ }
+
+ public function testGeoJsonToGml3Polygon() {
+ $geoJson = file_get_contents($this->geoJsonPolygon);
+ $expectedGml3 = file_get_contents($this->gml3Polygon);
+
+ $gmlObj = $this->gml3Factory->createFromGeoJson($geoJson);
+
+ $this->assertEquals(
+ $this->gml3Factory->removeWhiteSpace($expectedGml3),
+ $gmlObj->toGml()
+ );
+ }
+
+ public function testGeoJsonToGml3MultiPolygon() {
+ $geoJson = file_get_contents($this->geoJsonMultiPolygon);
+ $expectedGml3 = file_get_contents($this->gml3MultiPolygon);
+
+ $gmlObj = $this->gml3Factory->createFromGeoJson($geoJson);
+
+ $this->assertEquals(
+ $this->gml3Factory->removeWhiteSpace($expectedGml3),
+ $gmlObj->toGml()
+ );
+ }
+
+ public function testGeoJsonToGml3MultiPoint() {
+ $geoJson = file_get_contents($this->geoJsonMultiPoint);
+ $expectedGml3 = "";
+
+ $gmlObj = $this->gml3Factory->createFromGeoJson($geoJson);
+
+ $this->assertEquals(
+ $this->gml3Factory->removeWhiteSpace($expectedGml3),
+ $gmlObj->toGml()
+ );
+ }
+
+ public function testGeoJsonToGml3MultiLine() {
+ $geoJson = file_get_contents($this->geoJsonMultiLine);
+ $expectedGml3 = "";
+
+ $gmlObj = $this->gml3Factory->createFromGeoJson($geoJson);
+
+ $this->assertEquals(
+ $this->gml3Factory->removeWhiteSpace($expectedGml3),
+ $gmlObj->toGml()
+ );
+ }
+
+
+}
+?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list