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/Query/CommonTest.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php index a84d6397..016213a8 100644 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php @@ -1,12 +1,15 @@ <?php - namespace Elastica\Test\Query; +use Elastica\Document; use Elastica\Query\Common; use Elastica\Test\Base as BaseTest; class CommonTest extends BaseTest { + /** + * @group unit + */ public function testToArray() { $query = new Common('body', 'test query', .001); @@ -17,29 +20,32 @@ class CommonTest extends BaseTest 'body' => array( 'query' => 'test query', 'cutoff_frequency' => .001, - 'low_freq_operator' => 'and' - ) - ) + 'low_freq_operator' => 'and', + ), + ), ); $this->assertEquals($expected, $query->toArray()); } + /** + * @group functional + */ public function testQuery() { - $index = $this->_createIndex('common_test'); + $index = $this->_createIndex(); $type = $index->getType('test'); + $docs = array( + new Document(1, array('body' => 'foo baz')), + new Document(2, array('body' => 'foo bar baz')), + new Document(3, array('body' => 'foo bar baz bat')), + ); //add documents to create common terms - $docs = array(); - for ($i = 0; $i < 20; $i++) { - $docs[] = new \Elastica\Document($i, array('body' => 'foo bar')); + for ($i = 4; $i < 24; $i++) { + $docs[] = new Document($i, array('body' => 'foo bar')); } $type->addDocuments($docs); - - $type->addDocument(new \Elastica\Document(20, array('body' => 'foo baz'))); - $type->addDocument(new \Elastica\Document(21, array('body' => 'foo bar baz'))); - $type->addDocument(new \Elastica\Document(22, array('body' => 'foo bar baz bat'))); $index->refresh(); $query = new Common('body', 'foo bar baz bat', .5); @@ -53,7 +59,5 @@ class CommonTest extends BaseTest //only the document containing both low frequency terms should match $this->assertEquals(1, $results->count()); - - $index->delete(); } } |