Skip to content

Commit f652956

Browse files
committed
Check that same id is updated and new is not created
1 parent 3c569cb commit f652956

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/Unit/HasOneTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public function testFillAttributeForCreate()
7373
$this->assertEquals($profile->phone, '123123123');
7474
});
7575

76+
$id = $newEmployee->fresh()->profile->id;
77+
7678
$updateRequest = [
7779
'name' => 'Test 2',
7880
'profile' => [
@@ -86,8 +88,9 @@ public function testFillAttributeForCreate()
8688

8789
$newEmployee->save();
8890

89-
tap($newEmployee->fresh()->profile, function ($profile) {
91+
tap($newEmployee->fresh()->profile, function ($profile) use ($id) {
9092
$this->assertEquals($profile->phone, '456456456');
93+
$this->assertEquals($profile->id, $id);
9194
});
9295
}
9396
}

0 commit comments

Comments
 (0)