Skip to content

Commit 88c2f64

Browse files
committed
Added where() clause to test
1 parent be0597d commit 88c2f64

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/system/Database/Live/DeleteTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,16 @@ public function testDeleteBatch()
7575
['userid' => 2, 'username' => 'Ahmadinejad', 'unused' => 'You can have fields you dont use'],
7676
];
7777

78-
$this->db->table('user')
78+
$builder = $this->db->table('user')
7979
->setData($data, null, 'data')
80-
->onConstraint(['id' => 'userid', 'name' => 'username'])
81-
->deleteBatch();
80+
->onConstraint(['id' => 'userid', 'name' => 'username']);
81+
82+
// SQLite does not support where for batch deletes
83+
if ($this->db->DBDriver !== 'SQLite3') {
84+
$builder->where('data.userid > 0');
85+
}
86+
87+
$builder->deleteBatch();
8288

8389
$this->seeInDatabase('user', ['email' => '[email protected]', 'name' => 'Derek Jones']);
8490

0 commit comments

Comments
 (0)