@@ -305,20 +305,25 @@ public function testWheresWithArrayValue()
305305 $ this ->assertSame ('select * from "users" where "id" = ? ' , $ builder ->toSql ());
306306 $ this ->assertEquals ([0 => 12 ], $ builder ->getBindings ());
307307
308- // $builder = $this->getBuilder();
309- // $builder->select('*')->from('users')->where('id', '=', [12, 30]);
310- // $this->assertSame('select * from "users" where "id" = ?', $builder->toSql());
311- // $this->assertEquals([0 => 12, 1 => 30 ], $builder->getBindings());
308+ $ builder = $ this ->getBuilder ();
309+ $ builder ->select ('* ' )->from ('users ' )->where ('id ' , '= ' , [12 , 30 ]);
310+ $ this ->assertSame ('select * from "users" where "id" = ? ' , $ builder ->toSql ());
311+ $ this ->assertEquals ([0 => 12 ], $ builder ->getBindings ());
312312
313- // $builder = $this->getBuilder();
314- // $builder->select('*')->from('users')->where('id', '!=', [12, 30]);
315- // $this->assertSame('select * from "users" where "id" != ?', $builder->toSql());
316- // $this->assertEquals([0 => 12, 1 => 30 ], $builder->getBindings());
313+ $ builder = $ this ->getBuilder ();
314+ $ builder ->select ('* ' )->from ('users ' )->where ('id ' , '!= ' , [12 , 30 ]);
315+ $ this ->assertSame ('select * from "users" where "id" != ? ' , $ builder ->toSql ());
316+ $ this ->assertEquals ([0 => 12 ], $ builder ->getBindings ());
317317
318- // $builder = $this->getBuilder();
319- // $builder->select('*')->from('users')->where('id', '<>', [12, 30]);
320- // $this->assertSame('select * from "users" where "id" <> ?', $builder->toSql());
321- // $this->assertEquals([0 => 12, 1 => 30], $builder->getBindings());
318+ $ builder = $ this ->getBuilder ();
319+ $ builder ->select ('* ' )->from ('users ' )->where ('id ' , '<> ' , [12 , 30 ]);
320+ $ this ->assertSame ('select * from "users" where "id" <> ? ' , $ builder ->toSql ());
321+ $ this ->assertEquals ([0 => 12 ], $ builder ->getBindings ());
322+
323+ $ builder = $ this ->getBuilder ();
324+ $ builder ->select ('* ' )->from ('users ' )->where ('id ' , '= ' , [[12 , 30 ]]);
325+ $ this ->assertSame ('select * from "users" where "id" = ? ' , $ builder ->toSql ());
326+ $ this ->assertEquals ([0 => 12 ], $ builder ->getBindings ());
322327 }
323328
324329 public function testMySqlWrappingProtectsQuotationMarks ()
@@ -649,6 +654,16 @@ public function testWhereBetweens()
649654 $ this ->assertSame ('select * from "users" where "id" between ? and ? ' , $ builder ->toSql ());
650655 $ this ->assertEquals ([0 => 1 , 1 => 2 ], $ builder ->getBindings ());
651656
657+ $ builder = $ this ->getBuilder ();
658+ $ builder ->select ('* ' )->from ('users ' )->whereBetween ('id ' , [[1 , 2 , 3 ]]);
659+ $ this ->assertSame ('select * from "users" where "id" between ? and ? ' , $ builder ->toSql ());
660+ $ this ->assertEquals ([0 => 1 , 1 => 2 ], $ builder ->getBindings ());
661+
662+ $ builder = $ this ->getBuilder ();
663+ $ builder ->select ('* ' )->from ('users ' )->whereBetween ('id ' , [[1 ], [2 , 3 ]]);
664+ $ this ->assertSame ('select * from "users" where "id" between ? and ? ' , $ builder ->toSql ());
665+ $ this ->assertEquals ([0 => 1 , 1 => 2 ], $ builder ->getBindings ());
666+
652667 $ builder = $ this ->getBuilder ();
653668 $ builder ->select ('* ' )->from ('users ' )->whereNotBetween ('id ' , [1 , 2 ]);
654669 $ this ->assertSame ('select * from "users" where "id" not between ? and ? ' , $ builder ->toSql ());
@@ -1244,10 +1259,19 @@ public function testHavings()
12441259 $ builder = $ this ->getBuilder ();
12451260 $ builder ->select (['category ' , new Raw ('count(*) as "total" ' )])->from ('item ' )->where ('department ' , '= ' , 'popular ' )->groupBy ('category ' )->having ('total ' , '> ' , 3 );
12461261 $ this ->assertSame ('select "category", count(*) as "total" from "item" where "department" = ? group by "category" having "total" > ? ' , $ builder ->toSql ());
1262+ }
1263+
1264+ public function testHavingBetweens ()
1265+ {
1266+ $ builder = $ this ->getBuilder ();
1267+ $ builder ->select ('* ' )->from ('users ' )->havingBetween ('id ' , [1 , 2 , 3 ]);
1268+ $ this ->assertSame ('select * from "users" having "id" between ? and ? ' , $ builder ->toSql ());
1269+ $ this ->assertEquals ([0 => 1 , 1 => 2 ], $ builder ->getBindings ());
12471270
12481271 $ builder = $ this ->getBuilder ();
1249- $ builder ->select ('* ' )->from ('users ' )->havingBetween ('last_login_date ' , ['2018-11-16 ' , '2018-12-16 ' ]);
1250- $ this ->assertSame ('select * from "users" having "last_login_date" between ? and ? ' , $ builder ->toSql ());
1272+ $ builder ->select ('* ' )->from ('users ' )->havingBetween ('id ' , [[1 , 2 ], [3 , 4 ]]);
1273+ $ this ->assertSame ('select * from "users" having "id" between ? and ? ' , $ builder ->toSql ());
1274+ $ this ->assertEquals ([0 => 1 , 1 => 2 ], $ builder ->getBindings ());
12511275 }
12521276
12531277 public function testHavingShortcut ()
0 commit comments