Skip to content

Commit 2616911

Browse files
committed
Add test to ensure getter is working
1 parent c453bcf commit 2616911

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Integration/IgnoreGettersTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ class IgnoreGettersTest extends TestCase
1111
{
1212
use DatabaseTransactions;
1313

14+
/** @test */
15+
function it_return_the_default_value_when_attribute_is_null()
16+
{
17+
$user = User::create([
18+
'name' => 'foo',
19+
'email' => '[email protected]',
20+
'color' => null
21+
]);
22+
23+
$this->assertEquals('#000000', $user->color);
24+
$this->assertEquals('#000000', $user->refresh()->toArray()['color']);
25+
}
26+
1427
/** @test */
1528
public function it_return_the_getter_value_without_ignore_getters()
1629
{

0 commit comments

Comments
 (0)