@@ -16,6 +16,7 @@ public function setUp(): void
16
16
User::create (['name ' => 'Brett Boe ' , 'age ' => 35 , 'title ' => 'user ' ]);
17
17
User::create (['name ' => 'Tommy Toe ' , 'age ' => 33 , 'title ' => 'user ' ]);
18
18
User::create (['name ' => 'Yvonne Yoe ' , 'age ' => 35 , 'title ' => 'admin ' ]);
19
+ User::create (['name ' => 'John Smith ' , 'user-age ' => 28 , 'title ' => 'member ' ]);
19
20
User::create (['name ' => 'Error ' , 'age ' => null , 'title ' => null ]);
20
21
}
21
22
@@ -41,10 +42,10 @@ public function testWhere(): void
41
42
$ this ->assertCount (1 , $ users );
42
43
43
44
$ users = User::where ('age ' , '!= ' , 35 )->get ();
44
- $ this ->assertCount (6 , $ users );
45
+ $ this ->assertCount (7 , $ users );
45
46
46
47
$ users = User::where ('age ' , '<> ' , 35 )->get ();
47
- $ this ->assertCount (6 , $ users );
48
+ $ this ->assertCount (7 , $ users );
48
49
}
49
50
50
51
public function testAndWhere (): void
@@ -78,21 +79,24 @@ public function testLike(): void
78
79
79
80
$ users = User::where ('age ' , 'like ' , '%3 ' )->get ();
80
81
$ this ->assertCount (4 , $ users );
82
+
83
+ $ users = User::where ('user-age ' , 'like ' , '%28 ' )->get ();
84
+ $ this ->assertCount (1 , $ users );
81
85
}
82
86
83
87
public function testNotLike (): void
84
88
{
85
89
$ users = User::where ('name ' , 'not like ' , '%doe ' )->get ();
86
- $ this ->assertCount (7 , $ users );
90
+ $ this ->assertCount (8 , $ users );
87
91
88
92
$ users = User::where ('name ' , 'not like ' , '%y% ' )->get ();
89
- $ this ->assertCount (6 , $ users );
93
+ $ this ->assertCount (7 , $ users );
90
94
91
95
$ users = User::where ('name ' , 'not LIKE ' , '%y% ' )->get ();
92
- $ this ->assertCount (6 , $ users );
96
+ $ this ->assertCount (7 , $ users );
93
97
94
98
$ users = User::where ('name ' , 'not like ' , 't% ' )->get ();
95
- $ this ->assertCount (8 , $ users );
99
+ $ this ->assertCount (9 , $ users );
96
100
}
97
101
98
102
public function testSelect (): void
@@ -152,7 +156,7 @@ public function testIn(): void
152
156
$ this ->assertCount (6 , $ users );
153
157
154
158
$ users = User::whereNotIn ('age ' , [33 , 35 ])->get ();
155
- $ this ->assertCount (4 , $ users );
159
+ $ this ->assertCount (5 , $ users );
156
160
157
161
$ users = User::whereNotNull ('age ' )
158
162
->whereNotIn ('age ' , [33 , 35 ])->get ();
@@ -162,7 +166,7 @@ public function testIn(): void
162
166
public function testWhereNull (): void
163
167
{
164
168
$ users = User::whereNull ('age ' )->get ();
165
- $ this ->assertCount (1 , $ users );
169
+ $ this ->assertCount (2 , $ users );
166
170
}
167
171
168
172
public function testWhereNotNull (): void
@@ -195,7 +199,7 @@ public function testOrder(): void
195
199
public function testGroupBy (): void
196
200
{
197
201
$ users = User::groupBy ('title ' )->get ();
198
- $ this ->assertCount (3 , $ users );
202
+ $ this ->assertCount (4 , $ users );
199
203
200
204
$ users = User::groupBy ('age ' )->get ();
201
205
$ this ->assertCount (6 , $ users );
@@ -225,11 +229,11 @@ public function testGroupBy(): void
225
229
public function testCount (): void
226
230
{
227
231
$ count = User::where ('age ' , '<> ' , 35 )->count ();
228
- $ this ->assertEquals (6 , $ count );
232
+ $ this ->assertEquals (7 , $ count );
229
233
230
234
// Test for issue #165
231
235
$ count = User::select ('_id ' , 'age ' , 'title ' )->where ('age ' , '<> ' , 35 )->count ();
232
- $ this ->assertEquals (6 , $ count );
236
+ $ this ->assertEquals (7 , $ count );
233
237
}
234
238
235
239
public function testExists (): void
@@ -327,12 +331,12 @@ public function testPaginate(): void
327
331
$ results = User::paginate (2 );
328
332
$ this ->assertEquals (2 , $ results ->count ());
329
333
$ this ->assertNotNull ($ results ->first ()->title );
330
- $ this ->assertEquals (9 , $ results ->total ());
334
+ $ this ->assertEquals (10 , $ results ->total ());
331
335
332
336
$ results = User::paginate (2 , ['name ' , 'age ' ]);
333
337
$ this ->assertEquals (2 , $ results ->count ());
334
338
$ this ->assertNull ($ results ->first ()->title );
335
- $ this ->assertEquals (9 , $ results ->total ());
339
+ $ this ->assertEquals (10 , $ results ->total ());
336
340
$ this ->assertEquals (1 , $ results ->currentPage ());
337
341
}
338
342
@@ -399,4 +403,4 @@ public function testMultipleSortOrder(): void
399
403
$ this ->assertEquals ('John Doe ' , $ subset [1 ]->name );
400
404
$ this ->assertEquals ('Brett Boe ' , $ subset [2 ]->name );
401
405
}
402
- }
406
+ }
0 commit comments