Beispiel #1
0
 public function testParseFalseCircle()
 {
     $badradius = 'one km';
     $badcoord = '10°10°10", 10°10\'10"';
     $this->assertEquals(\FormatJson::encode($this->object->getMapData(array('circle=57.42129439209404,23.90625 : 326844.60518253763;', "circles=40,40:{$badradius}", 'service=leaflet'))), '{"circles":[{"radius":[326844.60518254],"pos":[{"lat":57.421294392094,"lon":23.90625}]}],"bounds":{"ne":{"lat":60.362317927612,"lon":29.843589207253},"sw":{"lat":54.480270856576,"lon":18.852584498495}}}');
     $circle = new Circle();
     $this->assertEquals($this->object->getErrorMessages(), array(\wfMessage('multimaps-unable-parse-radius', $badradius)->escaped(), \wfMessage('multimaps-unable-create-element', $circle->getElementName())->escaped()));
     $this->assertEquals(\FormatJson::encode($this->object->getMapData(array('circle=57.42129439209404,23.90625 : 326844.60518253763;', "circles={$badcoord}:{$badradius}", 'service=leaflet'))), '{"circles":[{"radius":[326844.60518254],"pos":[{"lat":57.421294392094,"lon":23.90625}]}],"bounds":{"ne":{"lat":60.362317927612,"lon":29.843589207253},"sw":{"lat":54.480270856576,"lon":18.852584498495}}}');
     $this->assertEquals($this->object->getErrorMessages(), array(\wfMessage('multimaps-unable-parse-coordinates', $badcoord)->escaped(), \wfMessage('multimaps-unable-create-element', $circle->getElementName())->escaped()));
     $this->assertEquals(\FormatJson::encode($this->object->getMapData(array('circle=57.42129439209404,23.90625 : 326844.60518253763;', "circles=40,40", 'service=leaflet'))), '{"circles":[{"radius":[326844.60518254],"pos":[{"lat":57.421294392094,"lon":23.90625}]}],"bounds":{"ne":{"lat":60.362317927612,"lon":29.843589207253},"sw":{"lat":54.480270856576,"lon":18.852584498495}}}');
     $this->assertEquals($this->object->getErrorMessages(), array(\wfMessage('multimaps-circle-radius-not-defined')->escaped(), \wfMessage('multimaps-unable-create-element', $circle->getElementName())->escaped()));
     $this->assertEquals(\FormatJson::encode($this->object->getMapData(array('circle=57.42129439209404,23.90625 : 326844.60518253763;', "circles=40,40:40000:8888", 'service=leaflet'))), '{"circles":[{"radius":[326844.60518254],"pos":[{"lat":57.421294392094,"lon":23.90625}]}],"bounds":{"ne":{"lat":60.362317927612,"lon":29.843589207253},"sw":{"lat":54.480270856576,"lon":18.852584498495}}}');
     $this->assertEquals($this->object->getErrorMessages(), array(\wfMessage('multimaps-circle-wrong-number-parameters', 3)->escaped(), \wfMessage('multimaps-unable-create-element', $circle->getElementName())->escaped()));
 }