File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public function setUp() {}
11
11
public function tearDown ()
12
12
{
13
13
DB ::collection ('users ' )->truncate ();
14
+ DB ::collection ('items ' )->truncate ();
14
15
}
15
16
16
17
public function testCollection ()
@@ -67,4 +68,23 @@ public function testSubKey()
67
68
$ this ->assertEquals ('John Doe ' , $ users [0 ]['name ' ]);
68
69
}
69
70
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
+
70
90
}
You can’t perform that action at this time.
0 commit comments