Beispiel #1
0
    public function testGeometryWithPropertiesAndId()
    {
        $this->sut->setFeatureId('test');
        $this->sut->setProperties(['testb' => 'testa']);
        $expectedJson = <<<END
{"type":"Feature","geometry":{"type":"Point","coordinates":[8.7,6.9]},"properties":{"testb":"testa"},"id":"test"}
END;
        $this->assertEquals($expectedJson, json_encode($this->sut));
    }
    public function testSingleFeature()
    {
        $point = new Point(8.699999999999999, 6.9);
        $feature = new Feature();
        $feature->setGeometry($point);
        $this->sut->addFeature($feature);
        $expectedJson = <<<END
{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[8.7,6.9]},"properties":{}}]}
END;
        $this->assertEquals($expectedJson, json_encode($this->sut));
    }