/** * Test the configuration array generation for the map object with enabled * layers. */ function testGetConfigurationArray_EnabledLayer() { // test standard map object settings $map = new OLMapObject(); $map->write(); // add a layer $layer = new OLLayer(); $layer->Enabled = "1"; $layer->MapID = $map->ID; $layer->write(); $result = $map->getConfigurationArray(); $array_layers = $result['Layers']; $this->assertEquals(sizeof($array_layers), 1); }
function testdogetfeatureinfo() { $url = Director::absoluteBaseURL() . self::$atlas_controller; $mapPage = new OLMapPage(); $mapPage->URLSegment = 'themap'; $mapurl = $mapPage->URLSegment; $mapPage->MapID = 1; $mapPage->write(); $layer = new OLLayer(); $layer->ID = 1; $layer->Title = 'allStations'; $layer->Url = $url; $layer->ogc_map = 'testmap'; $layer->ogc_name = 'stationdetails'; $layer->Enabled = 1; $layer->MapID = 1; $layer->SinglePopupHeader = 'stationdetails.1'; $layer->write(); $Map = new OLMapObject(); $Map->ID = 1; $Map->Title = "Map Title"; $Map->MinScale = "200"; $Map->AtlasLayerID = 1; $Map->write(); $resp = $this->post(Director::absoluteURL($mapurl . "/dogetfeatureinfo/1"), array("featureList" => "stationdetails.1")); $this->assertContains("stationdetails.1", $resp->getBody()); // wrong params try { $resp = $this->post(Director::absoluteURL($mapurl . "/dogetfeatureinfo/1"), array("featureList" => "stationdetails")); } catch (Exception $e) { $this->assertContains("FeatureType name not present in current request.", $e->getMessage()); return; } // empty params try { $resp = $this->get(Director::absoluteURL($mapurl . "/dogetfeatureinfo/1/")); } catch (Exception $e) { $this->assertEquals("Empty params", $e->getMessage()); return; } }