Skip to content

Commit 2154e87

Browse files
committed
Fix tests to not use query as set parameter
1 parent e3fd379 commit 2154e87

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

tests/system/Database/Live/InsertTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function testInsertBatchWithQuery()
218218
->join('user', 'user.email = user2.email', 'left')
219219
->where('user.email IS NULL');
220220

221-
$this->db->table('user')->insertBatch($subQuery);
221+
$this->db->table('user')->setQueryAsData($subQuery)->insertBatch();
222222

223223
$this->seeInDatabase('user', ['name' => 'New User user2']);
224224
$this->seeInDatabase('user', ['name' => 'New User2 user2']);

tests/system/Database/Live/UpdateTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,9 @@ public function testUpdateBatchWithQuery()
587587
->where('country', 'France');
588588

589589
$affectedRows = $this->db->table('user')
590+
->setQueryAsData($subQuery)
590591
->updateFields($updateFields, true)
591-
->updateBatch($subQuery, 'email');
592+
->updateBatch(null, 'email');
592593

593594
$this->assertSame(2, (int) $affectedRows);
594595

tests/system/Database/Live/UpsertTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,11 @@ public function testUpsertBatchWithQuery()
719719

720720
$subQuery = $this->db->table('user2')->select('email, name, country');
721721

722-
$this->db->table('user')->updateFields($updateFields, true)->onConstraint('email')->upsertBatch($subQuery);
722+
$this->db->table('user')
723+
->setQueryAsData($subQuery)
724+
->updateFields($updateFields, true)
725+
->onConstraint('email')
726+
->upsertBatch();
723727

724728
$this->seeInDatabase('user', ['name' => 'Derek Jones user2', 'email' => '[email protected]']);
725729
$this->seeInDatabase('user', ['name' => 'New User user2', 'email' => '[email protected]']);

0 commit comments

Comments
 (0)