Skip to content

Commit 2d7ba4e

Browse files
committed
Added test for update with no primary key per #1583.
1 parent 1e6ea98 commit 2d7ba4e

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/system/Database/Live/ModelTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,4 +764,28 @@ public function testSelectAndEntitiesSaveOnlyChangedValues()
764764
'description' => 'Plays guitar for Queen',
765765
]);
766766
}
767+
768+
public function testUpdateNoPrimaryKey()
769+
{
770+
$model = new SecondaryModel();
771+
772+
$this->db->table('secondary')->insert([
773+
'key' => 'foo',
774+
'value' => 'bar',
775+
]);
776+
777+
$this->dontSeeInDatabase('secondary', [
778+
'key' => 'bar',
779+
'value' => 'baz',
780+
]);
781+
782+
$model->where('key', 'foo')->update(null, ['key' => 'bar', 'value' => 'baz']);
783+
784+
$this->seeInDatabase('secondary', [
785+
'key' => 'bar',
786+
'value' => 'baz',
787+
]);
788+
}
789+
790+
//--------------------------------------------------------------------
767791
}

0 commit comments

Comments
 (0)