File tree Expand file tree Collapse file tree 6 files changed +50
-3
lines changed
docs/includes/usage-examples Expand file tree Collapse file tree 6 files changed +50
-3
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ public function testCount(): void
3636
3737 echo 'Number of documents: ' . $ count ;
3838 // end-eloquent-count
39+
40+ $ this ->assertEquals (2 , $ count );
3941
4042 // begin-qb-count
4143 $ count = DB ::table ('movies ' )
Original file line number Diff line number Diff line change @@ -38,7 +38,17 @@ public function testDeleteMany(): void
3838 // end-eloquent-delete-many
3939
4040 $ this ->assertEquals (2 , $ deleted );
41- $ this ->expectOutputString ('Deleted documents: 2Deleted documents: 0 ' );
41+
42+ Movie::insert ([
43+ [
44+ 'title ' => 'Train Pulling into a Station ' ,
45+ 'year ' => 1896 ,
46+ ],
47+ [
48+ 'title ' => 'The Ball Game ' ,
49+ 'year ' => 1898 ,
50+ ],
51+ ]);
4252
4353 // begin-qb-delete-many
4454 $ deleted = DB ::table ('movies ' )
@@ -47,5 +57,8 @@ public function testDeleteMany(): void
4757
4858 echo 'Deleted documents: ' . $ deleted ;
4959 // end-qb-delete-many
60+
61+ $ this ->assertEquals (2 , $ deleted );
62+ $ this ->expectOutputString ('Deleted documents: 2Deleted documents: 2 ' );
5063 }
5164}
Original file line number Diff line number Diff line change @@ -36,7 +36,13 @@ public function testDeleteOne(): void
3636 // end-eloquent-delete-one
3737
3838 $ this ->assertEquals (1 , $ deleted );
39- $ this ->expectOutputString ('Deleted documents: 1Deleted documents: 0 ' );
39+
40+ Movie::insert ([
41+ [
42+ 'title ' => 'Quiz Show ' ,
43+ 'runtime ' => 133 ,
44+ ],
45+ ]);
4046
4147 // begin-qb-delete-one
4248 $ deleted = DB ::table ('movies ' )
@@ -47,5 +53,9 @@ public function testDeleteOne(): void
4753
4854 echo 'Deleted documents: ' . $ deleted ;
4955 // end-qb-delete-one
56+
57+ $ this ->assertEquals (1 , $ deleted );
58+
59+ $ this ->expectOutputString ('Deleted documents: 1Deleted documents: 1 ' );
5060 }
5161}
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ public function testFindMany(): void
4040 ->get ();
4141 // end-eloquent-find
4242
43+ $ this ->assertEquals (2 , $ movies ->count ());
44+
4345 // begin-qb-find
4446 $ movies = DB ::table ('movies ' )
4547 ->where ('runtime ' , '> ' , 900 )
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ public function testInsertMany(): void
4141 echo 'Insert operation success: ' . ($ success ? 'yes ' : 'no ' );
4242 // end-eloquent-insert-many
4343
44+ $ this ->assertTrue ($ success );
45+
4446 // begin-qb-insert-many
4547 $ success = DB ::table ('movies ' )
4648 ->insert ([
Original file line number Diff line number Diff line change @@ -45,6 +45,23 @@ public function testUpdateMany(): void
4545
4646 $ this ->assertEquals (2 , $ updates );
4747
48+ Movie::insert ([
49+ [
50+ 'title ' => 'ABCD ' ,
51+ 'imdb ' => [
52+ 'rating ' => 9.5 ,
53+ 'votes ' => 1 ,
54+ ],
55+ ],
56+ [
57+ 'title ' => 'Testing ' ,
58+ 'imdb ' => [
59+ 'rating ' => 9.3 ,
60+ 'votes ' => 1 ,
61+ ],
62+ ],
63+ ]);
64+
4865 // begin-qb-update-many
4966 $ updates = DB ::table ('movies ' )
5067 ->where ('imdb.rating ' , '> ' , 9.0 )
@@ -53,6 +70,7 @@ public function testUpdateMany(): void
5370 echo 'Updated documents: ' . $ updates ;
5471 // end-qb-update-many
5572
56- $ this ->expectOutputString ('Updated documents: 2Updated documents: 0 ' );
73+ $ this ->assertEquals (2 , $ updates );
74+ $ this ->expectOutputString ('Updated documents: 2Updated documents: 2 ' );
5775 }
5876}
You can’t perform that action at this time.
0 commit comments