Skip to content

Commit

Permalink
补充 whereNotIn 测试
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX authored and liu21st committed Feb 26, 2021
1 parent 58d5c5d commit 39a9d0a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/orm/DbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,21 @@ public function testWhereIn()
$result = Db::table('test_user')->whereIn('type', [])->column('*');
$this->assertEquals([], $result);

$expected = Collection::make(self::$testUserData)->whereNotIn('type', [1, 3])->values()->toArray();
$result = Db::table('test_user')->whereNotIn('type', [1, 3])->column('*');
$this->assertEquals($expected, $result);

$expected = Collection::make(self::$testUserData)->values()->toArray();
$result = Db::table('test_user')->whereNotIn('type', [])->column('*');
$this->assertEquals($expected, $result);

$this->assertEquals([
"SELECT * FROM `test_user` WHERE `type` IN (1,3)",
"SELECT * FROM `test_user` WHERE `type` = 1",
"SELECT * FROM `test_user` WHERE `type` IN (1,0)",
"SELECT * FROM `test_user` WHERE 0 = 1",
"SELECT * FROM `test_user` WHERE `type` NOT IN (1,3)",
"SELECT * FROM `test_user` WHERE 1 = 1",
], $sqlLogs);
}

Expand Down

0 comments on commit 39a9d0a

Please sign in to comment.