@@ -158,6 +158,21 @@ public function testWhereNot()
158
158
$ this ->assertSame ('Bar Post ' , $ results [0 ]->title );
159
159
}
160
160
161
+ public function testWhereNotInputStringParameter ()
162
+ {
163
+ $ results = DB ::table ('posts ' )->whereNot ('title ' , 'Foo Post ' )->get ();
164
+
165
+ $ this ->assertCount (1 , $ results );
166
+ $ this ->assertSame ('Bar Post ' , $ results [0 ]->title );
167
+
168
+ DB ::table ('posts ' )->insert ([
169
+ ['title ' => 'Baz Post ' , 'content ' => 'Lorem Ipsum. ' , 'created_at ' => new Carbon ('2017-11-12 13:14:15 ' )],
170
+ ]);
171
+
172
+ $ results = DB ::table ('posts ' )->whereNot ('title ' , 'Foo Post ' )->whereNot ('title ' , 'Bar Post ' )->get ();
173
+ $ this ->assertSame ('Baz Post ' , $ results [0 ]->title );
174
+ }
175
+
161
176
public function testOrWhereNot ()
162
177
{
163
178
$ results = DB ::table ('posts ' )->where ('id ' , 1 )->orWhereNot (function ($ query ) {
@@ -233,6 +248,15 @@ public function testOrWhereTime()
233
248
$ this ->assertSame (2 , DB ::table ('posts ' )->where ('id ' , 1 )->orWhereTime ('created_at ' , new Carbon ('2018-01-02 03:04:05 ' ))->count ());
234
249
}
235
250
251
+ public function testWhereNested ()
252
+ {
253
+ $ results = DB ::table ('posts ' )->where ('content ' , 'Lorem Ipsum. ' )->whereNested (function ($ query ) {
254
+ $ query ->where ('title ' , 'Foo Post ' )
255
+ ->orWhere ('title ' , 'Bar Post ' );
256
+ })->count ();
257
+ $ this ->assertSame (2 , $ results );
258
+ }
259
+
236
260
public function testPaginateWithSpecificColumns ()
237
261
{
238
262
$ result = DB ::table ('posts ' )->paginate (5 , ['title ' , 'content ' ]);
0 commit comments