/** * @group unit */ public function testSetRelation() { $gsp = new GeoShapeProvided('location', array(array(25.0, 75.0), array(75.0, 25.0))); $gsp->setRelation(AbstractGeoShape::RELATION_INTERSECT); $this->assertEquals(AbstractGeoShape::RELATION_INTERSECT, $gsp->getRelation()); $this->assertInstanceOf('Elastica\\Filter\\GeoShapeProvided', $gsp->setRelation(AbstractGeoShape::RELATION_INTERSECT)); }
public function testConstructPolygon() { $polygon = array(array(102.0, 2.0), array(103.0, 2.0), array(103.0, 3.0), array(103.0, 3.0), array(102.0, 2.0)); $gsp = new GeoShapeProvided('location', $polygon, GeoShapeProvided::TYPE_POLYGON); $expected = array('geo_shape' => array('location' => array('shape' => array('type' => GeoShapeProvided::TYPE_POLYGON, 'coordinates' => $polygon), 'relation' => $gsp->getRelation()))); $this->assertEquals($expected, $gsp->toArray()); }