diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:31:33 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:31:33 -0400 |
commit | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (patch) | |
tree | 181f454813b310ee97385058c6c6f2e3f34d5fd8 /vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeoPolygonTest.php | |
parent | 7e85254903c7c0cb49e381f16b18441ea7b058cc (diff) | |
parent | 80f7dc77d430774192b929d780f96260066df2ee (diff) |
Merge commit '80f7dc'
# Conflicts:
# extensions/ArchInterWiki.sql
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeoPolygonTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeoPolygonTest.php | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeoPolygonTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeoPolygonTest.php deleted file mode 100644 index 7ebd738c..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/GeoPolygonTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace Elastica\Test\Filter; - -use Elastica\Document; -use Elastica\Filter\GeoPolygon; -use Elastica\Query; -use Elastica\Query\MatchAll; -use Elastica\Test\Base as BaseTest; - -class GeoPolygonTest extends BaseTest -{ - public function testGeoPoint() - { - $client = $this->_getClient(); - $index = $client->getIndex('test'); - $index->create(array(), true); - - $type = $index->getType('test'); - - // Set mapping - $type->setMapping(array('location' => array('type' => 'geo_point'))); - - // Add doc 1 - $doc1 = new Document(1, - array( - 'name' => 'ruflin', - ) - ); - - $doc1->addGeoPoint('location', 17, 19); - $type->addDocument($doc1); - - // Add doc 2 - $doc2 = new Document(2, - array( - 'name' => 'ruflin', - ) - ); - - $doc2->addGeoPoint('location', 30, 40); - $type->addDocument($doc2); - - $index->refresh(); - - // Only one point should be in polygon - $query = new Query(); - $points = array(array(16, 16), array(16, 20), array(20, 20), array(20, 16), array(16, 16)); - $geoFilter = new GeoPolygon('location', $points); - - $query = new Query(new MatchAll()); - $query->setFilter($geoFilter); - $this->assertEquals(1, $type->search($query)->count()); - - // Both points should be inside - $query = new Query(); - $points = array(array(16, 16), array(16, 40), array(40, 40), array(40, 16), array(16, 16)); - $geoFilter = new GeoPolygon('location', $points); - - $query = new Query(new MatchAll()); - $query->setFilter($geoFilter); - - $this->assertEquals(2, $type->search($query)->count()); - } -} |