File tree 6 files changed +50
-3
lines changed
docs/includes/usage-examples
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
36
36
37
37
echo 'Number of documents: ' . $ count ;
38
38
// end-eloquent-count
39
+
40
+ $ this ->assertEquals (2 , $ count );
39
41
40
42
// begin-qb-count
41
43
$ count = DB ::table ('movies ' )
Original file line number Diff line number Diff line change @@ -38,7 +38,17 @@ public function testDeleteMany(): void
38
38
// end-eloquent-delete-many
39
39
40
40
$ 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
+ ]);
42
52
43
53
// begin-qb-delete-many
44
54
$ deleted = DB ::table ('movies ' )
@@ -47,5 +57,8 @@ public function testDeleteMany(): void
47
57
48
58
echo 'Deleted documents: ' . $ deleted ;
49
59
// end-qb-delete-many
60
+
61
+ $ this ->assertEquals (2 , $ deleted );
62
+ $ this ->expectOutputString ('Deleted documents: 2Deleted documents: 2 ' );
50
63
}
51
64
}
Original file line number Diff line number Diff line change @@ -36,7 +36,13 @@ public function testDeleteOne(): void
36
36
// end-eloquent-delete-one
37
37
38
38
$ 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
+ ]);
40
46
41
47
// begin-qb-delete-one
42
48
$ deleted = DB ::table ('movies ' )
@@ -47,5 +53,9 @@ public function testDeleteOne(): void
47
53
48
54
echo 'Deleted documents: ' . $ deleted ;
49
55
// end-qb-delete-one
56
+
57
+ $ this ->assertEquals (1 , $ deleted );
58
+
59
+ $ this ->expectOutputString ('Deleted documents: 1Deleted documents: 1 ' );
50
60
}
51
61
}
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ public function testFindMany(): void
40
40
->get ();
41
41
// end-eloquent-find
42
42
43
+ $ this ->assertEquals (2 , $ movies ->count ());
44
+
43
45
// begin-qb-find
44
46
$ movies = DB ::table ('movies ' )
45
47
->where ('runtime ' , '> ' , 900 )
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ public function testInsertMany(): void
41
41
echo 'Insert operation success: ' . ($ success ? 'yes ' : 'no ' );
42
42
// end-eloquent-insert-many
43
43
44
+ $ this ->assertTrue ($ success );
45
+
44
46
// begin-qb-insert-many
45
47
$ success = DB ::table ('movies ' )
46
48
->insert ([
Original file line number Diff line number Diff line change @@ -45,6 +45,23 @@ public function testUpdateMany(): void
45
45
46
46
$ this ->assertEquals (2 , $ updates );
47
47
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
+
48
65
// begin-qb-update-many
49
66
$ updates = DB ::table ('movies ' )
50
67
->where ('imdb.rating ' , '> ' , 9.0 )
@@ -53,6 +70,7 @@ public function testUpdateMany(): void
53
70
echo 'Updated documents: ' . $ updates ;
54
71
// end-qb-update-many
55
72
56
- $ this ->expectOutputString ('Updated documents: 2Updated documents: 0 ' );
73
+ $ this ->assertEquals (2 , $ updates );
74
+ $ this ->expectOutputString ('Updated documents: 2Updated documents: 2 ' );
57
75
}
58
76
}
You can’t perform that action at this time.
0 commit comments