diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index 653c837058aa..c84b7f4d5522 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -111,6 +111,28 @@ public function testWhereAssociateArray() $this->assertSame($expectedBinds, $builder->getBinds()); } + public function testWhereAssociateArrayKeyHasEqualValueIsNull() + { + $builder = $this->db->table('user'); + + $where = [ + 'id <' => 100, + 'col1 =' => null, + ]; + + $expectedSQL = 'SELECT * FROM "user" WHERE "id" < 100 AND "col1" IS NULL'; + $expectedBinds = [ + 'id' => [ + 100, + true, + ], + ]; + + $builder->where($where); + $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); + $this->assertSame($expectedBinds, $builder->getBinds()); + } + public function testWhereCustomString() { $builder = $this->db->table('jobs');