diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeohashCellTest.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeohashCellTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeohashCellTest.php | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeohashCellTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeohashCellTest.php index 7cb8aef6..7ef0d04f 100644 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeohashCellTest.php +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeohashCellTest.php @@ -1,12 +1,17 @@ <?php - namespace Elastica\Test\Filter; -use Elastica\Test\Base as BaseTest; +use Elastica\Document; use Elastica\Filter\GeohashCell; +use Elastica\Query; +use Elastica\Test\Base as BaseTest; +use Elastica\Type\Mapping; class GeohashCellTest extends BaseTest { + /** + * @group unit + */ public function testToArray() { $filter = new GeohashCell('pin', array('lat' => 37.789018, 'lon' => -122.391506), '50m'); @@ -14,43 +19,46 @@ class GeohashCellTest extends BaseTest 'geohash_cell' => array( 'pin' => array( 'lat' => 37.789018, - 'lon' => -122.391506 + 'lon' => -122.391506, ), 'precision' => '50m', - 'neighbors' => false - ) + 'neighbors' => false, + ), ); $this->assertEquals($expected, $filter->toArray()); } + /** + * @group functional + */ public function testFilter() { - $index = $this->_createIndex('geohash_filter_test'); + $index = $this->_createIndex(); $type = $index->getType('test'); - $mapping = new \Elastica\Type\Mapping($type, array( + $mapping = new Mapping($type, array( 'pin' => array( 'type' => 'geo_point', 'geohash' => true, - 'geohash_prefix' => true - ) + 'geohash_prefix' => true, + ), )); $type->setMapping($mapping); - $type->addDocument(new \Elastica\Document(1, array('pin' => '9q8yyzm0zpw8'))); - $type->addDocument(new \Elastica\Document(2, array('pin' => '9mudgb0yued0'))); + $type->addDocument(new Document(1, array('pin' => '9q8yyzm0zpw8'))); + $type->addDocument(new Document(2, array('pin' => '9mudgb0yued0'))); $index->refresh(); $filter = new GeohashCell('pin', array('lat' => 32.828326, 'lon' => -117.255854)); - $query = new \Elastica\Query(); - $query->setFilter($filter); + $query = new Query(); + $query->setPostFilter($filter); $results = $type->search($query); $this->assertEquals(1, $results->count()); //test precision parameter $filter = new GeohashCell('pin', '9', 1); - $query = new \Elastica\Query(); - $query->setFilter($filter); + $query = new Query(); + $query->setPostFilter($filter); $results = $type->search($query); $this->assertEquals(2, $results->count()); |