From 15e69f7b20b6596b9148030acce5b59993b95a45 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Dec 2015 06:00:00 +0100 Subject: Update to MediaWiki 1.25.4 --- .../test/lib/Elastica/Test/Query/TermsTest.php | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Query/TermsTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Query/TermsTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/TermsTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/TermsTest.php new file mode 100644 index 00000000..184f3ad6 --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/TermsTest.php @@ -0,0 +1,62 @@ +_getClient(); + $index = $client->getIndex('test'); + $index->create(array(), true); + $type = $index->getType('helloworld'); + + $doc = new Document(1, array('name' => 'hello world')); + $type->addDocument($doc); + $doc = new Document(2, array('name' => 'nicolas ruflin')); + $type->addDocument($doc); + $doc = new Document(3, array('name' => 'ruflin')); + $type->addDocument($doc); + + $query = new Terms(); + $query->setTerms('name', array('nicolas', 'hello')); + + $index->refresh(); + + $resultSet = $type->search($query); + + $this->assertEquals(2, $resultSet->count()); + + $query->addTerm('ruflin'); + $resultSet = $type->search($query); + + $this->assertEquals(3, $resultSet->count()); + } + + public function testSetMinimum() + { + $key = 'name'; + $terms = array('nicolas', 'ruflin'); + $minimum = 2; + + $query = new Terms($key, $terms); + $query->setMinimumMatch($minimum); + + $data = $query->toArray(); + $this->assertEquals($minimum, $data['terms']['minimum_match']); + } + + /** + * @expectedException \Elastica\Exception\InvalidException + */ + public function testInvalidParams() + { + $query = new Terms(); + + $query->toArray(); + } +} -- cgit v1.2.2