Skip to content

Commit 92754b8

Browse files
committed
Adding in array test
1 parent 07b0932 commit 92754b8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: tests/QueryTest.php

+20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public function setUp() {}
1111
public function tearDown()
1212
{
1313
DB::collection('users')->truncate();
14+
DB::collection('items')->truncate();
1415
}
1516

1617
public function testCollection()
@@ -67,4 +68,23 @@ public function testSubKey()
6768
$this->assertEquals('John Doe', $users[0]['name']);
6869
}
6970

71+
public function testInArray()
72+
{
73+
$item1 = array(
74+
'tags' => array('tag1', 'tag2', 'tag3', 'tag4')
75+
);
76+
77+
$item2 = array(
78+
'tags' => array('tag2')
79+
);
80+
81+
DB::collection('items')->insert(array($item1, $item2));
82+
83+
$items = DB::collection('items')->where('tags', 'tag2')->get();
84+
$this->assertEquals(2, count($items));
85+
86+
$items = DB::collection('items')->where('tags', 'tag1')->get();
87+
$this->assertEquals(1, count($items));
88+
}
89+
7090
}

0 commit comments

Comments
 (0)