File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments