Skip to content

Commit

Permalink
Added test for update with no primary key per #1583.
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Dec 11, 2018
1 parent 1e6ea98 commit 2d7ba4e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/system/Database/Live/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -764,4 +764,28 @@ public function testSelectAndEntitiesSaveOnlyChangedValues()
'description' => 'Plays guitar for Queen',
]);
}

public function testUpdateNoPrimaryKey()
{
$model = new SecondaryModel();

$this->db->table('secondary')->insert([
'key' => 'foo',
'value' => 'bar',
]);

$this->dontSeeInDatabase('secondary', [
'key' => 'bar',
'value' => 'baz',
]);

$model->where('key', 'foo')->update(null, ['key' => 'bar', 'value' => 'baz']);

$this->seeInDatabase('secondary', [
'key' => 'bar',
'value' => 'baz',
]);
}

//--------------------------------------------------------------------
}

0 comments on commit 2d7ba4e

Please sign in to comment.