[Mapbender-commits] r7026 - in trunk/mapbender/test: data http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 5 07:04:02 EDT 2010


Author: christoph
Date: 2010-10-05 11:04:02 +0000 (Tue, 05 Oct 2010)
New Revision: 7026

Added:
   trunk/mapbender/test/data/line.gml2.xml
   trunk/mapbender/test/data/line.json
   trunk/mapbender/test/data/multiline.json
   trunk/mapbender/test/data/multipoint.gml2.xml
   trunk/mapbender/test/data/multipoint.json
   trunk/mapbender/test/data/multipolygon.gml2.xml
   trunk/mapbender/test/data/multipolygon.json
   trunk/mapbender/test/data/point.gml2.xml
   trunk/mapbender/test/data/point.json
   trunk/mapbender/test/data/polygon.gml2.xml
   trunk/mapbender/test/data/polygon.json
Modified:
   trunk/mapbender/test/http/classes/Gml2FactoryTest.php
Log:
unit tests for gml2 factory

Added: trunk/mapbender/test/data/line.gml2.xml
===================================================================
--- trunk/mapbender/test/data/line.gml2.xml	                        (rev 0)
+++ trunk/mapbender/test/data/line.gml2.xml	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1,3 @@
+<gml:MultiLineString srsName="EPSG:4326"><gml:lineStringMember><gml:LineString><gml:coordinates>-101.89,-20.71 -95.5,-21.93</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString>
+
+

Added: trunk/mapbender/test/data/line.json
===================================================================
--- trunk/mapbender/test/data/line.json	                        (rev 0)
+++ trunk/mapbender/test/data/line.json	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1,31 @@
+{
+    "type": "FeatureCollection",
+    "features": [
+        {
+            "type": "Feature",
+            "crs": {
+                "type": "name",
+                "properties": {
+                    "name": "EPSG:4326"
+                }
+            },
+            "geometry": {
+                "type": "LineString",
+                "coordinates": [
+                    [
+                        -101.89,
+                        -20.71
+                    ],
+                    [
+                        -95.5,
+                        -21.93
+                    ]
+                ]
+            },
+            "properties": {
+                "name": "x",
+                "style": "2"
+            }
+        }
+    ]
+}
\ No newline at end of file

Added: trunk/mapbender/test/data/multiline.json
===================================================================
--- trunk/mapbender/test/data/multiline.json	                        (rev 0)
+++ trunk/mapbender/test/data/multiline.json	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1,43 @@
+{
+    "type": "FeatureCollection",
+    "features": [
+        {
+            "type": "Feature",
+            "crs": {
+                "type": "name",
+                "properties": {
+                    "name": "EPSG:4326"
+                }
+            },
+            "geometry": {
+                "type": "MultiLineString",
+                "coordinates" : [
+                    [
+                        [
+                            100.0,
+                            0.0
+                        ],
+                        [
+                            101.0,
+                            1.0
+                        ]
+                    ],
+                    [
+                        [
+                            102.0,
+                            2.0
+                        ],
+                        [
+                            103.0,
+                            3.0
+                        ]
+                    ]
+                ]
+            },
+            "properties": {
+                "name": "MultiLineString",
+                "style": "2"
+            }
+        }
+    ]
+}
\ No newline at end of file

Added: trunk/mapbender/test/data/multipoint.gml2.xml
===================================================================
--- trunk/mapbender/test/data/multipoint.gml2.xml	                        (rev 0)
+++ trunk/mapbender/test/data/multipoint.gml2.xml	2010-10-05 11:04:02 UTC (rev 7026)
@@ -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/multipoint.json
===================================================================
--- trunk/mapbender/test/data/multipoint.json	                        (rev 0)
+++ trunk/mapbender/test/data/multipoint.json	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1,27 @@
+{
+    "type": "FeatureCollection",
+    "features": [
+        {
+            "type": "Feature",
+            "crs": {
+                "type": "name",
+                "properties": {
+                    "name": "EPSG:4326"
+                }
+            },
+            "geometry": {
+                "type": "MultiPoint",
+                "coordinates": [
+                    [
+                        1,
+                        2
+                    ]
+                ]
+            },
+            "properties": {
+                "name": "MultiPoint",
+                "style": "2"
+            }
+        }
+    ]
+}
\ No newline at end of file

Added: trunk/mapbender/test/data/multipolygon.gml2.xml
===================================================================
--- trunk/mapbender/test/data/multipolygon.gml2.xml	                        (rev 0)
+++ trunk/mapbender/test/data/multipolygon.gml2.xml	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1 @@
+<gml:MultiPolygon srsName='EPSG:4326'><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-101.18,-22.99 -100.07,-22.15 -99.9,-23.02 -100.48,-23.5 -101.49,-23.38 -101.18,-22.99</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-99.37,-22.13 -99.06,-22.32 -99.49,-22.95 -99.37,-22.13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>
\ No newline at end of file

Added: trunk/mapbender/test/data/multipolygon.json
===================================================================
--- trunk/mapbender/test/data/multipolygon.json	                        (rev 0)
+++ trunk/mapbender/test/data/multipolygon.json	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1,71 @@
+{
+    "type": "FeatureCollection",
+    "features": [
+        {
+            "type": "Feature",
+            "crs": {
+                "type": "name",
+                "properties": {
+                    "name": "EPSG:4326"
+                }
+            },
+            "geometry": {
+                "type": "MultiPolygon",
+                "coordinates": [
+                    [
+                        [
+                            [
+                                -101.18,
+                                -22.99
+                            ],
+                            [
+                                -100.07,
+                                -22.15
+                            ],
+                            [
+                                -99.9,
+                                -23.02
+                            ],
+                            [
+                                -100.48,
+                                -23.5
+                            ],
+                            [
+                                -101.49,
+                                -23.38
+                            ],
+                            [
+                                -101.18,
+                                -22.99
+                            ]
+                        ]
+                    ],
+                    [
+                        [
+                            [
+                                -99.37,
+                                -22.13
+                            ],
+                            [
+                                -99.06,
+                                -22.32
+                            ],
+                            [
+                                -99.49,
+                                -22.95
+                            ],
+                            [
+                                -99.37,
+                                -22.13
+                            ]
+                        ]
+                    ]
+                ]
+            },
+            "properties": {
+                "name": "testMultipolygon",
+                "style": "1"
+            }
+        }
+    ]
+}
\ No newline at end of file

Added: trunk/mapbender/test/data/point.gml2.xml
===================================================================
--- trunk/mapbender/test/data/point.gml2.xml	                        (rev 0)
+++ trunk/mapbender/test/data/point.gml2.xml	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1 @@
+<gml:Point srsName='EPSG:4326'><gml:coordinates>-98.89,-18.81</gml:coordinates></gml:Point>
\ No newline at end of file

Added: trunk/mapbender/test/data/point.json
===================================================================
--- trunk/mapbender/test/data/point.json	                        (rev 0)
+++ trunk/mapbender/test/data/point.json	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1,25 @@
+{
+    "type": "FeatureCollection",
+    "features": [
+        {
+            "type": "Feature",
+            "crs": {
+                "type": "name",
+                "properties": {
+                    "name": "EPSG:4326"
+                }
+            },
+            "geometry": {
+                "type": "Point",
+                "coordinates": [
+                    -98.89,
+                    -18.81
+                ]
+            },
+            "properties": {
+                "name": "testpoint",
+                "style": "1"
+            }
+        }
+    ]
+}
\ No newline at end of file

Added: trunk/mapbender/test/data/polygon.gml2.xml
===================================================================
--- trunk/mapbender/test/data/polygon.gml2.xml	                        (rev 0)
+++ trunk/mapbender/test/data/polygon.gml2.xml	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1 @@
+<gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-101.18,-22.99 -100.07,-22.15 -99.9,-23.02 -100.48,-23.5 -101.49,-23.38 -101.18,-22.99</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>
\ No newline at end of file

Added: trunk/mapbender/test/data/polygon.json
===================================================================
--- trunk/mapbender/test/data/polygon.json	                        (rev 0)
+++ trunk/mapbender/test/data/polygon.json	2010-10-05 11:04:02 UTC (rev 7026)
@@ -0,0 +1,49 @@
+{
+    "type": "FeatureCollection",
+    "features": [
+        {
+            "type": "Feature",
+            "crs": {
+                "type": "name",
+                "properties": {
+                    "name": "EPSG:4326"
+                }
+            },
+            "geometry": {
+                "type": "Polygon",
+                "coordinates": [
+                    [
+                        [
+                            -101.18,
+                            -22.99
+                        ],
+                        [
+                            -100.07,
+                            -22.15
+                        ],
+                        [
+                            -99.9,
+                            -23.02
+                        ],
+                        [
+                            -100.48,
+                            -23.5
+                        ],
+                        [
+                            -101.49,
+                            -23.38
+                        ],
+                        [
+                            -101.18,
+                            -22.99
+                        ]
+                    ]
+                ]
+            },
+            "properties": {
+                "name": "testpolygon",
+                "style": "2"
+            }
+        }
+    ]
+}
\ No newline at end of file

Modified: trunk/mapbender/test/http/classes/Gml2FactoryTest.php
===================================================================
--- trunk/mapbender/test/http/classes/Gml2FactoryTest.php	2010-10-04 16:24:29 UTC (rev 7025)
+++ trunk/mapbender/test/http/classes/Gml2FactoryTest.php	2010-10-05 11:04:02 UTC (rev 7026)
@@ -9,9 +9,23 @@
 
 	public function setUp () {
 		$this->geoJsonPolygonDonut = dirname(__FILE__) . "/../../data/polygonDonut.json";
-		$this->gml2PolygonDonutNoWhiteSpace = dirname(__FILE__) . "/../../data/polygonDonutNoWhiteSpace.gml2.xml";
 		$this->gml2PolygonDonut = dirname(__FILE__) . "/../../data/polygonDonut.gml2.xml";
+                $this->geoJsonLine = dirname(__FILE__) . "/../../data/line.json";
+		$this->gml2Line = dirname(__FILE__) . "/../../data/line.gml2.xml";
+                $this->geoJsonPoint = dirname(__FILE__) . "/../../data/point.json";
+		$this->gml2Point = dirname(__FILE__) . "/../../data/point.gml2.xml";
+                $this->geoJsonPolygon = dirname(__FILE__) . "/../../data/polygon.json";
+		$this->gml2Polygon = dirname(__FILE__) . "/../../data/polygon.gml2.xml";
+                $this->geoJsonMultiPolygon = dirname(__FILE__) . "/../../data/multipolygon.json";
+		$this->gml2MultiPolygon = dirname(__FILE__) . "/../../data/multipolygon.gml2.xml";
 
+                $this->geoJsonMultiLine = dirname(__FILE__) . "/../../data/multiline.json";
+		$this->gml2MultiLine = dirname(__FILE__) . "/../../data/multiline.gml2.xml";
+
+                $this->geoJsonMultiPoint = dirname(__FILE__) . "/../../data/multipoint.json";
+		$this->gml2MultiPoint = dirname(__FILE__) . "/../../data/multipoint.gml2.xml";
+
+                $this->gml2PolygonDonutNoWhiteSpace = dirname(__FILE__) . "/../../data/polygonDonutNoWhiteSpace.gml2.xml";
 		$this->gml2Factory = new Gml_2_Factory();
 	}
 
@@ -36,5 +50,79 @@
 			$gmlObj->toGml()
 		);
 	}
+
+        public function testGeoJsonToGml2Line() {
+		$geoJson = file_get_contents($this->geoJsonLine);
+		$expectedGml2 = file_get_contents($this->gml2Line);
+
+		$gmlObj = $this->gml2Factory->createFromGeoJson($geoJson);
+
+		$this->assertEquals(
+			$this->gml2Factory->removeWhiteSpace($expectedGml2),
+			$gmlObj->toGml()
+		);
+	}
+
+        public function testGeoJsonToGml2Point() {
+		$geoJson = file_get_contents($this->geoJsonPoint);
+		$expectedGml2 = file_get_contents($this->gml2Point);
+
+		$gmlObj = $this->gml2Factory->createFromGeoJson($geoJson);
+
+		$this->assertEquals(
+			$this->gml2Factory->removeWhiteSpace($expectedGml2),
+			$gmlObj->toGml()
+		);
+	}
+
+        public function testGeoJsonToGml2Polygon() {
+		$geoJson = file_get_contents($this->geoJsonPolygon);
+		$expectedGml2 = file_get_contents($this->gml2Polygon);
+
+		$gmlObj = $this->gml2Factory->createFromGeoJson($geoJson);
+
+		$this->assertEquals(
+			$this->gml2Factory->removeWhiteSpace($expectedGml2),
+			$gmlObj->toGml()
+		);
+	}
+
+        public function testGeoJsonToGml2MultiPolygon() {
+		$geoJson = file_get_contents($this->geoJsonMultiPolygon);
+		$expectedGml2 = file_get_contents($this->gml2MultiPolygon);
+
+		$gmlObj = $this->gml2Factory->createFromGeoJson($geoJson);
+
+		$this->assertEquals(
+			$this->gml2Factory->removeWhiteSpace($expectedGml2),
+			$gmlObj->toGml()
+		);
+	}
+
+        public function testGeoJsonToGml2MultiPoint() {
+		$geoJson = file_get_contents($this->geoJsonMultiPoint);
+		$expectedGml2 = "";
+
+		$gmlObj = $this->gml2Factory->createFromGeoJson($geoJson);
+
+		$this->assertEquals(
+			$this->gml2Factory->removeWhiteSpace($expectedGml2),
+			$gmlObj->toGml()
+		);
+	}
+
+        public function testGeoJsonToGml2MultiLine() {
+		$geoJson = file_get_contents($this->geoJsonMultiLine);
+		$expectedGml2 = "";
+
+		$gmlObj = $this->gml2Factory->createFromGeoJson($geoJson);
+
+		$this->assertEquals(
+			$this->gml2Factory->removeWhiteSpace($expectedGml2),
+			$gmlObj->toGml()
+		);
+	}
+
+ 
 }
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list