Commit e0edca24 by Dirk Adler

Improves mongodb nested and in condition test

parent 03206708
...@@ -130,20 +130,25 @@ class QueryRunTest extends MongoDbTestCase ...@@ -130,20 +130,25 @@ class QueryRunTest extends MongoDbTestCase
$this->assertEquals('name10', $rows[0]['name']); $this->assertEquals('name10', $rows[0]['name']);
} }
public function testCombinedInAndOrCondition() public function testNestedCombinedInAndCondition()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection();
$query = new Query; $query = new Query;
$rows = $query->from('customer') $rows = $query->from('customer')
->where([ ->where([
'name' => ['name1', 'name5', 'name10'] 'and',
['name' => ['name1', 'name2', 'name3']],
['name' => 'name1']
])
->orWhere([
'and',
['name' => ['name4', 'name5', 'name6']],
['name' => 'name6']
]) ])
->andWhere(['name' => 'name1'])
->orWhere(['name' => 'name5'])
->all($connection); ->all($connection);
$this->assertEquals(2, count($rows)); $this->assertEquals(2, count($rows));
$this->assertEquals('name1', $rows[0]['name']); $this->assertEquals('name1', $rows[0]['name']);
$this->assertEquals('name5', $rows[1]['name']); $this->assertEquals('name6', $rows[1]['name']);
} }
public function testOrder() public function testOrder()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment