/** * Basic test to see if getCMSFields returns a fieldset. */ function testGetCMSFields() { $layer = new OLMapObject(); $fieldset = $layer->getCMSFields(); $this->assertTrue(is_a($fieldset, "FieldSet")); }
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; } }