/** * Test geohash grid with multiple parameters. */ public function testGeoHashGridAggregationWithAditionalParameters() { $repo = $this->getManager()->getRepository('AcmeTestBundle:Product'); $agg = new GeoHashGridAggregation('test_agg'); $agg->setField('location'); $agg->setPrecision(2); $agg->setSize(2); $agg->setShardSize(1); $search = $repo->createSearch()->addAggregation($agg); $results = $repo->execute($search, Repository::RESULTS_RAW)['aggregations']['agg_test_agg']; $expectedResults = ['buckets' => [['key' => 'dr', 'doc_count' => 2], ['key' => 'u6', 'doc_count' => 1]]]; $this->assertEquals($expectedResults, $results); }
/** * Tests getType method. */ public function testGeoHashGridAggregationGetType() { $aggregation = new GeoHashGridAggregation('foo'); $result = $aggregation->getType(); $this->assertEquals('geohash_grid', $result); }