11<?php
2- require_once ('tests/app.php ' );
32
43use Illuminate \Support \Facades \DB ;
54
@@ -56,7 +55,7 @@ public function testInsert()
5655 $ this ->assertTrue (is_array ($ user ['tags ' ]));
5756 }
5857
59- public function testInsertGetId ()
58+ public function testInsertGetId ()
6059 {
6160 $ id = DB ::collection ('users ' )->insertGetId (array ('name ' => 'John Doe ' ));
6261
@@ -69,7 +68,7 @@ public function testBatchInsert()
6968 DB ::collection ('users ' )->insert (array (
7069 array (
7170 'tags ' => array ('tag1 ' , 'tag2 ' ),
72- 'name ' => 'Jane Doe ' ,
71+ 'name ' => 'Jane Doe ' ,
7372 ),
7473 array (
7574 'tags ' => array ('tag3 ' ),
@@ -93,6 +92,12 @@ public function testFind()
9392 $ this ->assertEquals ('John Doe ' , $ user ['name ' ]);
9493 }
9594
95+ public function testFindNull ()
96+ {
97+ $ user = DB ::collection ('users ' )->find (null );
98+ $ this ->assertEquals (null , $ user );
99+ }
100+
96101 public function testCount ()
97102 {
98103 DB ::collection ('users ' )->insert (array (
@@ -201,14 +206,14 @@ public function testPush()
201206 ));
202207
203208 DB ::collection ('users ' )->where ('_id ' , $ id )->push ('tags ' , 'tag1 ' );
204-
209+
205210 $ user = DB ::collection ('users ' )->find ($ id );
206211 $ this ->assertTrue (is_array ($ user ['tags ' ]));
207212 $ this ->assertEquals (1 , count ($ user ['tags ' ]));
208213 $ this ->assertEquals ('tag1 ' , $ user ['tags ' ][0 ]);
209214
210215 DB ::collection ('users ' )->where ('_id ' , $ id )->push ('tags ' , 'tag2 ' );
211-
216+
212217 $ user = DB ::collection ('users ' )->find ($ id );
213218 $ this ->assertTrue (is_array ($ user ['tags ' ]));
214219 $ this ->assertEquals (2 , count ($ user ['tags ' ]));
@@ -233,7 +238,7 @@ public function testPull()
233238 ));
234239
235240 DB ::collection ('users ' )->where ('_id ' , $ id )->pull ('tags ' , 'tag3 ' );
236-
241+
237242 $ user = DB ::collection ('users ' )->find ($ id );
238243 $ this ->assertTrue (is_array ($ user ['tags ' ]));
239244 $ this ->assertEquals (3 , count ($ user ['tags ' ]));
@@ -408,4 +413,4 @@ public function testUnset()
408413 $ this ->assertFalse (isset ($ user2 ['note2 ' ]));
409414 }
410415
411- }
416+ }
0 commit comments