summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/GeoClusterTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/GeoClusterTest.php')
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/GeoClusterTest.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/GeoClusterTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/GeoClusterTest.php
index d06b58f9..f771ac32 100644
--- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/GeoClusterTest.php
+++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Facet/GeoClusterTest.php
@@ -1,42 +1,50 @@
<?php
-
namespace Elastica\Test\Facet;
+use Elastica\Document;
+use Elastica\Facet\GeoCluster;
+use Elastica\Query;
use Elastica\Test\Base as BaseTest;
-
-class GeoClusterTest extends BaseTest{
- public function testQuery() {
+use Elastica\Type\Mapping;
+
+class GeoClusterTest extends BaseTest
+{
+ /**
+ * @group functional
+ */
+ public function testQuery()
+ {
$client = $this->_getClient();
$nodes = $client->getCluster()->getNodes();
- if(!$nodes[0]->getInfo()->hasPlugin('geocluster-facet')){
+ if (!$nodes[0]->getInfo()->hasPlugin('geocluster-facet')) {
$this->markTestSkipped('geocluster-facet plugin not installed');
}
- $index = $this->_createIndex('geocluster_test');
+ $index = $this->_createIndex();
$type = $index->getType('testQuery');
$geoField = 'location';
- $type->setMapping(new \Elastica\Type\Mapping($type, array(
- $geoField => array( 'type' => 'geo_point', 'lat_lon' => true )
+ $type->setMapping(new Mapping($type, array(
+ $geoField => array('type' => 'geo_point', 'lat_lon' => true),
)));
- $doc = new \Elastica\Document(1, array('name' => 'item1', 'location' => array(20,20)));
+ $doc = new Document(1, array('name' => 'item1', 'location' => array(20, 20)));
$type->addDocument($doc);
- $doc = new \Elastica\Document(2, array('name' => 'item2', 'location' => array(20,20)));
+ $doc = new Document(2, array('name' => 'item2', 'location' => array(20, 20)));
$type->addDocument($doc);
- $doc = new \Elastica\Document(3, array('name' => 'item3', 'location' => array(20,20)));
+ $doc = new Document(3, array('name' => 'item3', 'location' => array(20, 20)));
$type->addDocument($doc);
$index->refresh();
- $facet = new \Elastica\Facet\GeoCluster('clusters');
+ $facet = new GeoCluster('clusters');
$facet
->setField($geoField)
->setFactor(1)
->setShowIds(false);
- $query = new \Elastica\Query();
+ $query = new Query();
$query->setFacets(array($facet));
$response = $type->search($query);
@@ -46,4 +54,4 @@ class GeoClusterTest extends BaseTest{
$index->delete();
}
-} \ No newline at end of file
+}