/** * 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); }
/** * Test the business logic around GetFeatureInfo. This method calls * getWFS/WMSFeature methods, sends the HTTP request to the OGC server and returns * the server response. */ function testGetFeatureInfo_wmsUntiled() { $layer = new OLLayer(); $layer->Type = 'wmsUntiled'; $layer->ogc_name = "featureType"; $layer->ogc_map = "TestMap"; $url = Director::absoluteBaseURL() . self::$test_controller; $layer->Url = $url; $layer->write(); $params = array('BBOX' => 'bbox', 'x' => 'x', 'y' => 'y', 'WIDTH' => 'width', 'HEIGHT' => 'height'); $response = $layer->getFeatureInfo($params); $obj = json_decode($response, 1); // get project-path from the absolute URL $baseUrl = array_slice(explode('/', Director::absoluteBaseURL()), 3); $projectPath = implode("/", $baseUrl); // verify/assert response $this->assertEquals($obj['url'], "/" . $projectPath . self::$test_controller); $this->assertEquals($obj['map'], "TestMap"); $this->assertEquals($obj['REQUEST'], "GetFeatureInfo"); $this->assertEquals($obj['INFO_FORMAT'], "application/vnd.ogc.gml"); $this->assertEquals($obj['VERSION'], "1.1.1"); $this->assertEquals($obj['TRANSPARENT'], true); $this->assertEquals($obj['EXCEPTIONS'], "application/vnd.ogc.se_xml"); $this->assertEquals($obj['FORMAT'], "image/png"); $this->assertEquals($obj['SRS'], "EPSG:4326"); $this->assertEquals($obj['LAYERS'], "featureType"); $this->assertEquals($obj['QUERY_LAYERS'], "featureType"); $this->assertEquals($obj['BBOX'], "bbox"); $this->assertEquals($obj['x'], "x"); $this->assertEquals($obj['y'], "y"); $this->assertEquals($obj['WIDTH'], "width"); $this->assertEquals($obj['HEIGHT'], "height"); $this->assertEquals($obj['isget'], true); }
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; } }