From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- .../test/lib/Elastica/Test/Filter/BoolAndTest.php | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php new file mode 100644 index 00000000..a8f47633 --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php @@ -0,0 +1,86 @@ +assertEquals(array('and' => array()), $and->toArray()); + + $idsFilter = new Ids(); + $idsFilter->setIds(12); + + $and->addFilter($idsFilter); + $and->addFilter($idsFilter); + + $expectedArray = array( + 'and' => array( + $idsFilter->toArray(), + $idsFilter->toArray(), + ), + ); + + $this->assertEquals($expectedArray, $and->toArray()); + } + + /** + * @group functional + */ + public function testSetCache() + { + $client = $this->_getClient(); + $index = $client->getIndex('test'); + $index->create(array(), true); + $type = $index->getType('test'); + + $type->addDocuments(array( + new Document(1, array('name' => 'hello world')), + new Document(2, array('name' => 'nicolas ruflin')), + new Document(3, array('name' => 'ruflin')), + )); + + $and = new BoolAnd(); + + $idsFilter1 = new Ids(); + $idsFilter1->setIds(1); + + $idsFilter2 = new Ids(); + $idsFilter2->setIds(1); + + $and->addFilter($idsFilter1); + $and->addFilter($idsFilter2); + + $index->refresh(); + $and->setCached(true); + + $resultSet = $type->search($and); + + $this->assertEquals(1, $resultSet->count()); + } + + /** + * @group unit + */ + public function testConstruct() + { + $ids1 = new Ids('foo', array(1, 2)); + $ids2 = new Ids('bar', array(3, 4)); + + $and1 = new BoolAnd(array($ids1, $ids2)); + + $and2 = new BoolAnd(); + $and2->addFilter($ids1); + $and2->addFilter($ids2); + + $this->assertEquals($and1->toArray(), $and2->toArray()); + } +} -- cgit v1.2.3-54-g00ecf