[Mapbender-commits] r7003 - branches/mapbender/test/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Oct 2 09:51:46 EDT 2010


Author: christoph
Date: 2010-10-02 13:51:46 +0000 (Sat, 02 Oct 2010)
New Revision: 7003

Modified:
   branches/mapbender/test/http/classes/FilterTest.php
   branches/mapbender/test/http/classes/GeoRssFactoryTest.php
   branches/mapbender/test/http/classes/GeoRssTest.php
   branches/mapbender/test/http/classes/GetApiTest.php
   branches/mapbender/test/http/classes/MapTest.php
   branches/mapbender/test/http/classes/RssTest.php
Log:
tests failed when using pdo

found this workaround: http://article.gmane.org/gmane.comp.web.ezcomponents.devel/4501

also formatted sources

Modified: branches/mapbender/test/http/classes/FilterTest.php
===================================================================
--- branches/mapbender/test/http/classes/FilterTest.php	2010-10-01 19:09:38 UTC (rev 7002)
+++ branches/mapbender/test/http/classes/FilterTest.php	2010-10-02 13:51:46 UTC (rev 7003)
@@ -4,133 +4,138 @@
 
 class FilterTest extends PHPUnit_Framework_TestCase {
 
-	public function testConstructorEmpty () {
-		$filter = new Filter();
-		
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "";
-		$sqlObject->v = array();
-		$sqlObject->t = array();
-		$this->assertEquals($sqlObject, $filter->toSql());
-	}
+    public function __construct () {
+        $this->backupGlobals = false;
+        $this->backupStaticAttributes = false;
+    }
 
-	public function testOperatorLike () {
-		$filter = new Filter("LIKE", "a", "%a");
-		
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "a LIKE $1";
-		$sqlObject->v = array("%a");
-		$sqlObject->t = array("s");
-		$this->assertEquals($sqlObject, $filter->toSql());
-	}
+    public function testConstructorEmpty () {
+        $filter = new Filter();
 
-	public function testConstructorOperatorKeyValue () {
-		$filter = new Filter("=", "a", "b");
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "a = $1";
-		$sqlObject->v = array("b");
-		$sqlObject->t = array("s");
-		$this->assertEquals($sqlObject, $filter->toSql());
-	}
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "";
+        $sqlObject->v = array();
+        $sqlObject->t = array();
+        $this->assertEquals($sqlObject, $filter->toSql());
+    }
 
-	public function testConstructorOperatorKeyValueArray () {
-		$filter = new Filter("IN", "a", array("a", "b", "c"));
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "a IN ($1,$2,$3)";
-		$sqlObject->v = array("a", "b", "c");
-		$sqlObject->t = array("s", "s", "s");
-		$this->assertEquals($sqlObject, $filter->toSql());
-	}
+    public function testOperatorLike () {
+        $filter = new Filter("LIKE", "a", "%a");
 
-	public function testConstructorOperatorFilterArray () {
-		$filterA = new Filter("=", "a", "b");
-		$filterB = new Filter(">=", "b", 3);
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "a LIKE $1";
+        $sqlObject->v = array("%a");
+        $sqlObject->t = array("s");
+        $this->assertEquals($sqlObject, $filter->toSql());
+    }
 
-		$filter = new Filter("AND", array($filterA, $filterB));
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "(a = $1 AND b >= $2)";
-		$sqlObject->v = array("b", 3);
-		$sqlObject->t = array("s", "i");
-		$this->assertEquals($sqlObject, $filter->toSql());
-	}
-	
-	public function testConstructorRecursive() {
-		$filterA1 = new Filter("=", "a", "b");
-		$filterB1 = new Filter(">=", "b", 3);
-		$filter1all = new Filter("AND",array($filterA1,$filterB1));
-		
-		$filterA2 = new Filter("=", "c", "d");
-		$filterB2 = new Filter(">=", "e", 4);
-		$filter2all = new Filter("AND",array($filterA2,$filterB2));
+    public function testConstructorOperatorKeyValue () {
+        $filter = new Filter("=", "a", "b");
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "a = $1";
+        $sqlObject->v = array("b");
+        $sqlObject->t = array("s");
+        $this->assertEquals($sqlObject, $filter->toSql());
+    }
 
-		$filter = new Filter("AND", array($filter1all, $filter2all));
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "((a = $1 AND b >= $2) AND (c = $3 AND e >= $4))";
-		$sqlObject->v = array("b", 3, "d", 4);
-		$sqlObject->t = array("s", "i","s", "i");
-		$this->assertEquals($sqlObject, $filter->toSql());
-	}
-	
-	public function testConstructorOneFilter () {
-		$filterA = new Filter("=", "a", "b");
-		$filterB = new Filter("AND", array($filterA));
+    public function testConstructorOperatorKeyValueArray () {
+        $filter = new Filter("IN", "a", array("a", "b", "c"));
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "a IN ($1,$2,$3)";
+        $sqlObject->v = array("a", "b", "c");
+        $sqlObject->t = array("s", "s", "s");
+        $this->assertEquals($sqlObject, $filter->toSql());
+    }
 
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "(a = $1)";
-		$sqlObject->v = array("b");
-		$sqlObject->t = array("s");
-		
-		$this->assertEquals($sqlObject, $filterB->toSql());
-	}
+    public function testConstructorOperatorFilterArray () {
+        $filterA = new Filter("=", "a", "b");
+        $filterB = new Filter(">=", "b", 3);
 
-	public function testConstructorTwoFiltersOneEmpty () {
-		$filterA = new Filter("=", "a", "b");
-		$filterB = new Filter();
-		$filterC = new Filter("AND", array($filterA, $filterB));
+        $filter = new Filter("AND", array($filterA, $filterB));
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "(a = $1 AND b >= $2)";
+        $sqlObject->v = array("b", 3);
+        $sqlObject->t = array("s", "i");
+        $this->assertEquals($sqlObject, $filter->toSql());
+    }
 
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "(a = $1)";
-		$sqlObject->v = array("b");
-		$sqlObject->t = array("s");
-		
-		$this->assertEquals($sqlObject, $filterC->toSql());
-	}
+    public function testConstructorRecursive() {
+        $filterA1 = new Filter("=", "a", "b");
+        $filterB1 = new Filter(">=", "b", 3);
+        $filter1all = new Filter("AND",array($filterA1,$filterB1));
 
-	public function testConstructorTwoFiltersOneEmptyReordered () {
-		$filterA = new Filter("AND", array(new Filter()));
-		$filterB = new Filter("=", "a", "b");
-		$filterC = new Filter("AND", array($filterA, $filterB));
+        $filterA2 = new Filter("=", "c", "d");
+        $filterB2 = new Filter(">=", "e", 4);
+        $filter2all = new Filter("AND",array($filterA2,$filterB2));
 
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "(a = $1)";
-		$sqlObject->v = array("b");
-		$sqlObject->t = array("s");
-		
-		$this->assertEquals($sqlObject, $filterC->toSql());
-	}
+        $filter = new Filter("AND", array($filter1all, $filter2all));
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "((a = $1 AND b >= $2) AND (c = $3 AND e >= $4))";
+        $sqlObject->v = array("b", 3, "d", 4);
+        $sqlObject->t = array("s", "i","s", "i");
+        $this->assertEquals($sqlObject, $filter->toSql());
+    }
 
-	public function testContructorFalse () {
-		$filterA = new Filter("FALSE");
+    public function testConstructorOneFilter () {
+        $filterA = new Filter("=", "a", "b");
+        $filterB = new Filter("AND", array($filterA));
 
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "FALSE";
-		$sqlObject->v = array();
-		$sqlObject->t = array();
-		
-		$this->assertEquals($sqlObject, $filterA->toSql());
-	}
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "(a = $1)";
+        $sqlObject->v = array("b");
+        $sqlObject->t = array("s");
 
-	public function testContructorFalseMultiple () {
-		$filterA = new Filter("FALSE");
-		$filterB = new Filter("=", "b", 6);
-		$filterAnd = new Filter("AND", array($filterA, $filterB));
-		
-		$sqlObject = new stdClass();
-		$sqlObject->sql = "(FALSE AND b = $1)";
-		$sqlObject->v = array(6);
-		$sqlObject->t = array("i");
-		
-		$this->assertEquals($sqlObject, $filterAnd->toSql());
-	}
+        $this->assertEquals($sqlObject, $filterB->toSql());
+    }
+
+    public function testConstructorTwoFiltersOneEmpty () {
+        $filterA = new Filter("=", "a", "b");
+        $filterB = new Filter();
+        $filterC = new Filter("AND", array($filterA, $filterB));
+
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "(a = $1)";
+        $sqlObject->v = array("b");
+        $sqlObject->t = array("s");
+
+        $this->assertEquals($sqlObject, $filterC->toSql());
+    }
+
+    public function testConstructorTwoFiltersOneEmptyReordered () {
+        $filterA = new Filter("AND", array(new Filter()));
+        $filterB = new Filter("=", "a", "b");
+        $filterC = new Filter("AND", array($filterA, $filterB));
+
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "(a = $1)";
+        $sqlObject->v = array("b");
+        $sqlObject->t = array("s");
+
+        $this->assertEquals($sqlObject, $filterC->toSql());
+    }
+
+    public function testContructorFalse () {
+        $filterA = new Filter("FALSE");
+
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "FALSE";
+        $sqlObject->v = array();
+        $sqlObject->t = array();
+
+        $this->assertEquals($sqlObject, $filterA->toSql());
+    }
+
+    public function testContructorFalseMultiple () {
+        $filterA = new Filter("FALSE");
+        $filterB = new Filter("=", "b", 6);
+        $filterAnd = new Filter("AND", array($filterA, $filterB));
+
+        $sqlObject = new stdClass();
+        $sqlObject->sql = "(FALSE AND b = $1)";
+        $sqlObject->v = array(6);
+        $sqlObject->t = array("i");
+
+        $this->assertEquals($sqlObject, $filterAnd->toSql());
+    }
 }
 ?>
\ No newline at end of file

Modified: branches/mapbender/test/http/classes/GeoRssFactoryTest.php
===================================================================
--- branches/mapbender/test/http/classes/GeoRssFactoryTest.php	2010-10-01 19:09:38 UTC (rev 7002)
+++ branches/mapbender/test/http/classes/GeoRssFactoryTest.php	2010-10-02 13:51:46 UTC (rev 7003)
@@ -2,28 +2,30 @@
 require_once 'PHPUnit/Framework.php';
 require_once dirname(__FILE__) . "/../../../http/classes/class_universal_rss_factory.php";
 
-class GeoRssFactoryTest extends PHPUnit_Framework_TestCase
-{
-	var $someRssFactory;
-	var $geoRss;
-	var $filename;
-	
-	public function setUp () {
-		$this->someRssFactory = new UniversalRssFactory();		
-		$this->filename = dirname(__FILE__) . "/../../data/GeoRss_PortalU.xml";
-    	$this->geoRss = $this->someRssFactory->createFromUrl($this->filename);
-	}
+class GeoRssFactoryTest extends PHPUnit_Framework_TestCase {
+    var $someRssFactory;
+    var $geoRss;
+    var $filename;
 
-	public function tearDown () {
-		unset($this->someRssFactory);	
-	}
-	
-	public function testCreateFromUrl()
-    {
+    public function __construct () {
+        $this->backupGlobals = false;
+        $this->backupStaticAttributes = false;
+    }
+
+    public function setUp () {
+        $this->someRssFactory = new UniversalRssFactory();
+        $this->filename = dirname(__FILE__) . "/../../data/GeoRss_PortalU.xml";
+        $this->geoRss = $this->someRssFactory->createFromUrl($this->filename);
+    }
+
+    public function tearDown () {
+        unset($this->someRssFactory);
+    }
+
+    public function testCreateFromUrl() {
         $this->assertNotNull($this->geoRss);
     }
-    public function testIsGeoRss()
-    {
+    public function testIsGeoRss() {
         $this->assertEquals("GeoRss", get_class($this->geoRss));
     }
 }

Modified: branches/mapbender/test/http/classes/GeoRssTest.php
===================================================================
--- branches/mapbender/test/http/classes/GeoRssTest.php	2010-10-01 19:09:38 UTC (rev 7002)
+++ branches/mapbender/test/http/classes/GeoRssTest.php	2010-10-02 13:51:46 UTC (rev 7003)
@@ -2,89 +2,86 @@
 require_once 'PHPUnit/Framework.php';
 require_once dirname(__FILE__) . "/../../../http/classes/class_georss_factory.php";
 
-class GeoRssTest extends PHPUnit_Framework_TestCase
-{
+class GeoRssTest extends PHPUnit_Framework_TestCase {
 
-	var $geoRss;
-	var $filename;
-	protected $randomRss;
+    var $geoRss;
+    var $filename;
+    protected $randomRss;
 
-	public function setUp () {
-    	$this->randomRss = dirname(__FILE__) . "/../../data/randomRss.xml";
-		$this->geoRssFactory = new GeoRssFactory();
-		$this->filename = dirname(__FILE__) . "/../../data/GeoRss_PortalU.xml";
-    	$this->geoRss = $this->geoRssFactory->createFromUrl($this->filename);
+    public function __construct () {
+        $this->backupGlobals = false;
+        $this->backupStaticAttributes = false;
+    }
 
+    public function setUp () {
+        $this->randomRss = dirname(__FILE__) . "/../../data/randomRss.xml";
+        $this->geoRssFactory = new GeoRssFactory();
+        $this->filename = dirname(__FILE__) . "/../../data/GeoRss_PortalU.xml";
+        $this->geoRss = $this->geoRssFactory->createFromUrl($this->filename);
+
     }
 
-	public function tearDown () {
-		unset($this->geoRssFactory);
-	}
+    public function tearDown () {
+        unset($this->geoRssFactory);
+    }
 
-	public function testTitleCorrect()
-    {
+    public function testTitleCorrect() {
         $this->assertEquals(
-        	"ingrid OpenSearch: wms datatype:metadata ranking:score",
-        	$this->geoRss->channel_title
+            "ingrid OpenSearch: wms datatype:metadata ranking:score",
+            $this->geoRss->channel_title
         );
     }
-    public function testDescriptionCorrect()
-    {
+    public function testDescriptionCorrect() {
         $this->assertEquals(
-        	"Search results",
-        	$this->geoRss->channel_description
+            "Search results",
+            $this->geoRss->channel_description
         );
     }
-    public function testUrlCorrect()
-    {
+    public function testUrlCorrect() {
         $this->assertEquals(
-        	"http://213.144.28.233:80/opensearch/query?q=wms+datatype:metadata+ranking:score&h=10&p=1&xml=1&georss=1&ingrid=1",
-        	htmlentities($this->geoRss->channel_url, ENT_QUOTES, "UTF-8")
+            "http://213.144.28.233:80/opensearch/query?q=wms+datatype:metadata+ranking:score&h=10&p=1&xml=1&georss=1&ingrid=1",
+            htmlentities($this->geoRss->channel_url, ENT_QUOTES, "UTF-8")
         );
     }
-    public function testBboxCorrect()
-    {
-    	$geoRssFactory = new GeoRssFactory();
-		$geoRss = $geoRssFactory->createFromUrl($this->filename);
-	   	$item = $this->geoRss->getItem(2);
-		$this->assertType('GeoRssItem',$item);
-		$bbox = $item->getBbox();
-		$this->assertType('Mapbender_bbox',$bbox);
-		$this->assertEquals(12.0016, $bbox->min->x);
-		$this->assertEquals(54.0477, $bbox->min->y);
-		$this->assertEquals(12.2862, $bbox->max->x);
-		$this->assertEquals(54.2481, $bbox->max->y);
+    public function testBboxCorrect() {
+        $geoRssFactory = new GeoRssFactory();
+        $geoRss = $geoRssFactory->createFromUrl($this->filename);
+        $item = $this->geoRss->getItem(2);
+        $this->assertType('GeoRssItem',$item);
+        $bbox = $item->getBbox();
+        $this->assertType('Mapbender_bbox',$bbox);
+        $this->assertEquals(12.0016, $bbox->min->x);
+        $this->assertEquals(54.0477, $bbox->min->y);
+        $this->assertEquals(12.2862, $bbox->max->x);
+        $this->assertEquals(54.2481, $bbox->max->y);
 
     }
-	public function testCreateGeoRssAt()
-	{
-		$anotherRssFactory = new GeoRssFactory();
-		$anotherGeoRss = $anotherRssFactory->createAt($this->randomRss);
-		$this->assertNotNull(
-        	$anotherGeoRss
+    public function testCreateGeoRssAt() {
+        $anotherRssFactory = new GeoRssFactory();
+        $anotherGeoRss = $anotherRssFactory->createAt($this->randomRss);
+        $this->assertNotNull(
+            $anotherGeoRss
         );
-	}
-	public function testCreateGeoRssFromUrl()
-	{
-		$someGeoRssFactory = new GeoRssFactory();
-		$yetAnotherGeoRss = $someGeoRssFactory->createFromUrl($this->filename);
-		$this->assertEquals(
-        	"GeoRss",
-        	get_class($yetAnotherGeoRss)
+    }
+    public function testCreateGeoRssFromUrl() {
+        $someGeoRssFactory = new GeoRssFactory();
+        $yetAnotherGeoRss = $someGeoRssFactory->createFromUrl($this->filename);
+        $this->assertEquals(
+            "GeoRss",
+            get_class($yetAnotherGeoRss)
         );
-	}
-	public function testAppendItemToGeoRss()
-	{
-		$anotherRssFactory = new GeoRssFactory();
-		$anotherGeoRss = $anotherRssFactory->createAt($this->randomRss);
-		$someGeoRssFactory = new GeoRssFactory();
-		$yetAnotherGeoRss = $someGeoRssFactory->createFromUrl($this->randomRss);
-		$yetAnotherGeoRss->setTitle("testTitel");
-		$yetAnotherGeoRss->setDescription("testDescription");
-		$yetAnotherGeoRss->setUrl("testUrl");
-		$item = $yetAnotherGeoRss->append();
-		$item->setBbox(new Mapbender_bbox(8,49,9,50,"EPSG:4326"));
-		$this->assertTrue($yetAnotherGeoRss->saveAsFile());
-	}
+    }
+    public function testAppendItemToGeoRss() {
+        $anotherRssFactory = new GeoRssFactory();
+        $anotherGeoRss = $anotherRssFactory->createAt($this->randomRss);
+        $someGeoRssFactory = new GeoRssFactory();
+        $yetAnotherGeoRss = $someGeoRssFactory->createFromUrl($this->randomRss);
+        $yetAnotherGeoRss->setTitle("testTitel");
+        $yetAnotherGeoRss->setDescription("testDescription");
+        $yetAnotherGeoRss->setUrl("testUrl");
+        $item = $yetAnotherGeoRss->append();
+        $item->setBbox(new Mapbender_bbox(8,49,9,50,"EPSG:4326"));
+        $this->assertTrue($yetAnotherGeoRss->saveAsFile());
+    }
 }
 ?>
\ No newline at end of file

Modified: branches/mapbender/test/http/classes/GetApiTest.php
===================================================================
--- branches/mapbender/test/http/classes/GetApiTest.php	2010-10-01 19:09:38 UTC (rev 7002)
+++ branches/mapbender/test/http/classes/GetApiTest.php	2010-10-02 13:51:46 UTC (rev 7003)
@@ -4,151 +4,156 @@
 
 class GetApiTest extends PHPUnit_Framework_TestCase {
 
-	public function testSingleLayer () {
-		parse_str("LAYER=12", $getArray);
+    public function __construct () {
+        $this->backupGlobals = false;
+        $this->backupStaticAttributes = false;
+    }
 
-		$apiObject = new GetApi($getArray);
-		
-		$expected = array(
-			array(
-				"id" => 12
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getLayers());
-	}
+    public function testSingleLayer () {
+        parse_str("LAYER=12", $getArray);
 
-	public function testSingleLayerFromApplication () {
-		parse_str("LAYER[application]=gui1&LAYER[id]=12", $getArray);
-		$apiObject = new GetApi($getArray);
-		
-		$expected = array(
-			array(
-				"id" => 12,
-				"application" => "gui1"
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getLayers());
-	}
+        $apiObject = new GetApi($getArray);
+        
+        $expected = array(
+            array(
+            "id" => 12
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getLayers());
+    }
 
-	public function testMultipleLayer () {
-		parse_str("LAYER[0][application]=gui1&LAYER[0][id]=12&LAYER[1]=13", $getArray);
-		$apiObject = new GetApi($getArray);
-		
-		$expected = array(
-			array(
-				"id" => 12,
-				"application" => "gui1"
-			),
-			array(
-				"id" => 13
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getLayers());
-	}
+    public function testSingleLayerFromApplication () {
+        parse_str("LAYER[application]=gui1&LAYER[id]=12", $getArray);
+        $apiObject = new GetApi($getArray);
 
-	public function testMultipleLayerComplex () {
-		parse_str("LAYER[visible]=0&LAYER[zoom]=1&LAYER[application]=gui1&LAYER[id]=12", $getArray);
-		$apiObject = new GetApi($getArray);
-		
-		$expected = array(
-			array(
-				"id" => 12,
-				"application" => "gui1",
-				"visible" => 0,
-				"zoom" => 1
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getLayers());
-	}
-	
-	public function testSingleFeaturetype () {
-		parse_str("FEATURETYPE=12", $getArray);
-		$apiObject = new GetApi($getArray);
-		
-		$expected = array(
-			array(
-				"id" => 12
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getFeaturetypes());
-	}
-	
-	public function testMultipleFeaturetypes () {
-		parse_str("FEATURETYPE=12,13", $getArray);
-		$apiObject = new GetApi($getArray);
-		
-		$expected = array(
-			array(
-				"id" => 12
-			),
-			array(
-				"id" => 13
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getFeaturetypes());
-	}
+        $expected = array(
+            array(
+            "id" => 12,
+            "application" => "gui1"
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getLayers());
+    }
 
-	public function testMultipleFeaturetypesArray () {
-		parse_str("FEATURETYPE[]=12&FEATURETYPE[]=13", $getArray);
-		$apiObject = new GetApi($getArray);
-		
-		$expected = array(
-			array(
-				"id" => 12
-			),
-			array(
-				"id" => 13
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getFeaturetypes());
-	}
+    public function testMultipleLayer () {
+        parse_str("LAYER[0][application]=gui1&LAYER[0][id]=12&LAYER[1]=13", $getArray);
+        $apiObject = new GetApi($getArray);
 
-	public function testMultipleFeaturetypesArrayComplex () {
-		parse_str("FEATURETYPE[active]=0&FEATURETYPE[search][firstname]=a&FEATURETYPE[search][lastname]=b&FEATURETYPE[id]=12", $getArray);
-		$apiObject = new GetApi($getArray);
+        $expected = array(
+            array(
+            "id" => 12,
+            "application" => "gui1"
+            ),
+            array(
+            "id" => 13
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getLayers());
+    }
 
-		$expected = array(
-			array(
-				"id" => 12,
-				"active" => 0,
-				"search" => array(
-					"firstname" => "a",
-					"lastname" => "b"
-				)
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getFeaturetypes());
-	}
+    public function testMultipleLayerComplex () {
+        parse_str("LAYER[visible]=0&LAYER[zoom]=1&LAYER[application]=gui1&LAYER[id]=12", $getArray);
+        $apiObject = new GetApi($getArray);
 
-	public function testWmcSimple () {
-		parse_str("WMC=12", $getArray);
-		$apiObject = new GetApi($getArray);
+        $expected = array(
+            array(
+            "id" => 12,
+            "application" => "gui1",
+            "visible" => 0,
+            "zoom" => 1
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getLayers());
+    }
 
-		$expected = array(
-			array(
-				"id" => 12
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getWmc());
-	}
+    public function testSingleFeaturetype () {
+        parse_str("FEATURETYPE=12", $getArray);
+        $apiObject = new GetApi($getArray);
 
-	public function testWmcSimpleMultiple () {
-		parse_str("WMC=12,13,14", $getArray);
-		$apiObject = new GetApi($getArray);
+        $expected = array(
+            array(
+            "id" => 12
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getFeaturetypes());
+    }
 
-		$expected = array(
-			array(
-				"id" => 12
-			),
-			array(
-				"id" => 13
-			),
-			array(
-				"id" => 14
-			)
-		);
-		$this->assertEquals($expected, $apiObject->getWmc());
-	}
+    public function testMultipleFeaturetypes () {
+        parse_str("FEATURETYPE=12,13", $getArray);
+        $apiObject = new GetApi($getArray);
 
+        $expected = array(
+            array(
+            "id" => 12
+            ),
+            array(
+            "id" => 13
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getFeaturetypes());
+    }
+
+    public function testMultipleFeaturetypesArray () {
+        parse_str("FEATURETYPE[]=12&FEATURETYPE[]=13", $getArray);
+        $apiObject = new GetApi($getArray);
+
+        $expected = array(
+            array(
+            "id" => 12
+            ),
+            array(
+            "id" => 13
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getFeaturetypes());
+    }
+
+    public function testMultipleFeaturetypesArrayComplex () {
+        parse_str("FEATURETYPE[active]=0&FEATURETYPE[search][firstname]=a&FEATURETYPE[search][lastname]=b&FEATURETYPE[id]=12", $getArray);
+        $apiObject = new GetApi($getArray);
+
+        $expected = array(
+            array(
+            "id" => 12,
+            "active" => 0,
+            "search" => array(
+            "firstname" => "a",
+            "lastname" => "b"
+            )
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getFeaturetypes());
+    }
+
+    public function testWmcSimple () {
+        parse_str("WMC=12", $getArray);
+        $apiObject = new GetApi($getArray);
+
+        $expected = array(
+            array(
+            "id" => 12
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getWmc());
+    }
+
+    public function testWmcSimpleMultiple () {
+        parse_str("WMC=12,13,14", $getArray);
+        $apiObject = new GetApi($getArray);
+
+        $expected = array(
+            array(
+            "id" => 12
+            ),
+            array(
+            "id" => 13
+            ),
+            array(
+            "id" => 14
+            )
+        );
+        $this->assertEquals($expected, $apiObject->getWmc());
+    }
+
 }
 ?>
\ No newline at end of file

Modified: branches/mapbender/test/http/classes/MapTest.php
===================================================================
--- branches/mapbender/test/http/classes/MapTest.php	2010-10-01 19:09:38 UTC (rev 7002)
+++ branches/mapbender/test/http/classes/MapTest.php	2010-10-02 13:51:46 UTC (rev 7003)
@@ -2,50 +2,50 @@
 require_once 'PHPUnit/Framework.php';
 require_once dirname(__FILE__) . "/../../../http/classes/class_map.php";
 
-class MapTest extends PHPUnit_Framework_TestCase
-{
+class MapTest extends PHPUnit_Framework_TestCase {
 
-	var $map;
-	
-	public function setUp () {
-		$this->map = new Map();
-		echo "setup";
-	}
+    var $map;
 
-	public function tearDown () {
-		unset($this->map);
-	}
-	
-	public function testMapCreate()
-    {
+    public function __construct () {
+        $this->backupGlobals = false;
+        $this->backupStaticAttributes = false;
+    }
+
+    public function setUp () {
+        $this->map = new Map();
+        echo "setup";
+    }
+
+    public function tearDown () {
+        unset($this->map);
+    }
+
+    public function testMapCreate() {
         $this->assertNotNull(
-        	$this->map
+            $this->map
         );
     }
 
-	public function testMapSetWidthHeight()
-    {
-    	$this->map->setWidth(100);
+    public function testMapSetWidthHeight() {
+        $this->map->setWidth(100);
         $this->assertEquals(100,$this->map->getWidth(100));
         $this->map->setHeight(100);
         $this->assertEquals(100,$this->map->getHeight(100));
     }
-    
-	public function testMapSetExtent()
-    {
-    	$mapExtent = new Mapbender_bbox(0,0,20,20,"EPSG:4326");
-    	$this->map->setExtent($mapExtent);
-		$this->assertEquals($mapExtent,$this->map->getExtent());
-		echo "-- testMapSetExtent";
-    } 
-       
-	public function testMapGetEpsg()
-    {
-    	$mapExtent = new Mapbender_bbox(0,0,20,20,"EPSG:4326");
-    	$this->map->setExtent($mapExtent);    
-		$this->assertEquals('EPSG:4326',$this->map->getEpsg());
-		echo "-- testMapGetEpsg";
-    } 
 
+    public function testMapSetExtent() {
+        $mapExtent = new Mapbender_bbox(0,0,20,20,"EPSG:4326");
+        $this->map->setExtent($mapExtent);
+        $this->assertEquals($mapExtent,$this->map->getExtent());
+        echo "-- testMapSetExtent";
+    }
+
+    public function testMapGetEpsg() {
+        $mapExtent = new Mapbender_bbox(0,0,20,20,"EPSG:4326");
+        $this->map->setExtent($mapExtent);
+        $this->assertEquals('EPSG:4326',$this->map->getEpsg());
+        echo "-- testMapGetEpsg";
+    }
+
 }
 ?>
\ No newline at end of file

Modified: branches/mapbender/test/http/classes/RssTest.php
===================================================================
--- branches/mapbender/test/http/classes/RssTest.php	2010-10-01 19:09:38 UTC (rev 7002)
+++ branches/mapbender/test/http/classes/RssTest.php	2010-10-02 13:51:46 UTC (rev 7003)
@@ -2,38 +2,40 @@
 require_once 'PHPUnit/Framework.php';
 require_once dirname(__FILE__) . "/../../../http/classes/class_rss_factory.php";
 
-class RssTest extends PHPUnit_Framework_TestCase
-{
-	var $rss;
+class RssTest extends PHPUnit_Framework_TestCase {
+    var $rss;
 
-	protected $someRssFactory;
-	protected $randomRss;
+    protected $someRssFactory;
+    protected $randomRss;
 
-	public function setUp () {
-    	$this->randomRss = dirname(__FILE__) . "/../../data/randomRss.xml";
-	}
+    public function __construct () {
+        $this->backupGlobals = false;
+        $this->backupStaticAttributes = false;
+    }
 
-	public function testCreateRssAt()
-    {
-    	$this->someRssFactory = new RssFactory();
-    	$anotherRss = $this->someRssFactory->createAt($this->randomRss);
-    	$this->assertNotNull(
-        	$anotherRss
+    public function setUp () {
+        $this->randomRss = dirname(__FILE__) . "/../../data/randomRss.xml";
+    }
+
+    public function testCreateRssAt() {
+        $this->someRssFactory = new RssFactory();
+        $anotherRss = $this->someRssFactory->createAt($this->randomRss);
+        $this->assertNotNull(
+            $anotherRss
         );
-	}
+    }
     /*
      * @depends testCreateRssAt
     */
-	public function testCreateRssFromUrl()
-	{
-    	$this->someRssFactory = new RssFactory();
-		$yetAnotherRss = $this->someRssFactory->createFromUrl($this->randomRss);
-		$this->assertEquals(
-        	"Rss",
-        	get_class($yetAnotherRss)
+    public function testCreateRssFromUrl() {
+        $this->someRssFactory = new RssFactory();
+        $yetAnotherRss = $this->someRssFactory->createFromUrl($this->randomRss);
+        $this->assertEquals(
+            "Rss",
+            get_class($yetAnotherRss)
         );
 
         unlink($this->randomRss);
-	}
+    }
 }
 ?>



More information about the Mapbender_commits mailing list