1
0
Fork 0
mirror of https://github.com/archtechx/virtualcolumn.git synced 2025-12-12 14:14:05 +00:00

Don't break with Model::shouldBeStrict()` enabled

This commit is contained in:
Nick Potts 2024-04-06 20:46:01 +08:00
parent 7371aac2ab
commit 4a8031266f
3 changed files with 23 additions and 1 deletions

View file

@ -128,6 +128,20 @@ class VirtualColumnTest extends TestCase
$this->assertSame($encodedBar->bar, 'bar');
}
/** @test */
public function decoding_works_with_strict_mode_enabled() {
FooModel::shouldBeStrict();
FooModel::create([
'id' => 1,
'foo' => 'bar'
]);
$id = FooModel::query()->pluck('id')->first();
$this->assertSame(1, $id);
}
// maybe add an explicit test that the saving() and updating() listeners don't run twice?
/** @test */