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/BoolAndTest.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php index 672c6c67..a8f47633 100644 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolAndTest.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Test\Filter; use Elastica\Document; @@ -9,6 +8,9 @@ use Elastica\Test\Base as BaseTest; class BoolAndTest extends BaseTest { + /** + * @group unit + */ public function testToArray() { $and = new BoolAnd(); @@ -23,13 +25,16 @@ class BoolAndTest extends BaseTest $expectedArray = array( 'and' => array( $idsFilter->toArray(), - $idsFilter->toArray() - ) + $idsFilter->toArray(), + ), ); $this->assertEquals($expectedArray, $and->toArray()); } + /** + * @group functional + */ public function testSetCache() { $client = $this->_getClient(); @@ -37,12 +42,11 @@ class BoolAndTest extends BaseTest $index->create(array(), true); $type = $index->getType('test'); - $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); + $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(); @@ -62,4 +66,21 @@ class BoolAndTest extends BaseTest $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()); + } } |