[Mapbender-commits] r4718 - trunk/mapbender/test/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Sep 26 11:13:43 EDT 2009


Author: verenadiewald
Date: 2009-09-26 11:13:43 -0400 (Sat, 26 Sep 2009)
New Revision: 4718

Modified:
   trunk/mapbender/test/http/classes/GeoRssTest.php
Log:


Modified: trunk/mapbender/test/http/classes/GeoRssTest.php
===================================================================
--- trunk/mapbender/test/http/classes/GeoRssTest.php	2009-09-26 15:11:04 UTC (rev 4717)
+++ trunk/mapbender/test/http/classes/GeoRssTest.php	2009-09-26 15:13:43 UTC (rev 4718)
@@ -1,42 +1,91 @@
 <?php
 require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . "/../../../http/classes/class_universal_rss_factory.php";
 require_once dirname(__FILE__) . "/../../../http/classes/class_georss_factory.php";
 
 class GeoRssTest extends PHPUnit_Framework_TestCase
 {
 
 	var $geoRss;
-	
+	var $randomRss;
+
 	public function setUp () {
-		$this->geoRssFactory = new GeoRssFactory();		
+		$this->geoRssFactory = new GeoRssFactory();
 		$filename = "../../data/GeoRss_PortalU.xml";
     	$this->geoRss = $this->geoRssFactory->createFromUrl($filename);
+    	$this->randomRss = str_replace(".xml", "_" . rand() . ".xml", "../../http/tmp/rss.xml");
 	}
 
 	public function tearDown () {
-		unset($this->geoRssFactory);	
+		unset($this->geoRssFactory);
 	}
-	
+
 	public function testTitleCorrect()
     {
         $this->assertEquals(
-        	"ingrid OpenSearch: wms datatype:metadata ranking:score", 
+        	"ingrid OpenSearch: wms datatype:metadata ranking:score",
         	$this->geoRss->channel_title
         );
     }
     public function testDescriptionCorrect()
     {
         $this->assertEquals(
-        	"Search results", 
+        	"Search results",
         	$this->geoRss->channel_description
         );
-    }    
+    }
     public function testUrlCorrect()
     {
         $this->assertEquals(
-        	"http://213.144.28.233:80/opensearch/query?q=wms+datatype:metadata+ranking:score&amp;h=10&amp;p=1&amp;xml=1&amp;georss=1&amp;ingrid=1", 
+        	"http://213.144.28.233:80/opensearch/query?q=wms+datatype:metadata+ranking:score&amp;h=10&amp;p=1&amp;xml=1&amp;georss=1&amp;ingrid=1",
         	htmlentities($this->geoRss->channel_url, ENT_QUOTES, "UTF-8")
         );
     }
+    public function testBboxCorrect()
+    {
+    	$box = $this->geoRss->getItem(2)->getBbox();
+		$boxString =
+			$box->min->x . " " . $box->min->y . " " .
+			$box->max->x . " " . $box->max->y;
+    	$this->assertEquals(
+        	"12.0016 54.0477 12.2862 54.2481",
+        	$boxString
+        );
+    }
+    public function testCreateRssAt()
+    {
+    	$aSecondRssFactory = new RssFactory();
+		$anotherRss = $aSecondRssFactory->createAt($this->randomRss);
+		$this->assertNotNull(
+        	$anotherRss
+        );
+	}
+	public function testCreateRssFromUrl()
+	{
+		$someRssFactory = new UniversalRssFactory();
+		#echo $this->randomRss;
+		$yetAnotherRss = $someRssFactory->createFromUrl($this->randomRss);
+		$this->assertEquals(
+        	"Rss",
+        	get_class($yetAnotherRss)
+        );
+	}
+	public function testCreateGeoRssAt()
+	{
+		$anotherRssFactory = new GeoRssFactory();
+		$anotherGeoRss = $anotherRssFactory->createAt($this->randomRss);
+		$this->assertNotNull(
+        	$anotherGeoRss
+        );
+	}
+//	public function testCreateGeoRssFromUrl()
+//	{
+//		$someRssFactory = new UniversalRssFactory();
+//		$yetAnotherGeoRss = $someRssFactory->createFromUrl($this->randomRss);
+//		$this->assertEquals(
+//        	"GeoRss",
+//        	get_class($yetAnotherGeoRss)
+//        );
+//	}
 }
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list