Skip to content

Commit ffd7477

Browse files
committed
Test case for Entity __isset method
1 parent 12c7eb0 commit ffd7477

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/system/EntityTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,17 @@ public function testHasChangedWholeEntity()
673673
$this->assertTrue($entity->hasChanged());
674674
}
675675

676+
public function testIssetKeyMap()
677+
{
678+
$entity = $this->getEntity();
679+
680+
$entity->created_at = '12345678';
681+
$this->assertTrue(isset($entity->createdAt));
682+
683+
$entity->bar = 'foo';
684+
$this->assertTrue(isset($entity->FakeBar));
685+
}
686+
676687
protected function getEntity()
677688
{
678689
return new class extends Entity
@@ -691,6 +702,10 @@ protected function getEntity()
691702
'created_at' => null,
692703
];
693704

705+
protected $datamap = [
706+
'createdAt' => 'created_at',
707+
];
708+
694709
public function setBar($value)
695710
{
696711
$this->attributes['bar'] = "bar:{$value}";
@@ -703,6 +718,10 @@ public function getBar()
703718
return "{$this->attributes['bar']}:bar";
704719
}
705720

721+
public function getFakeBar()
722+
{
723+
return "{$this->attributes['bar']}:bar";
724+
}
706725
};
707726
}
708727

0 commit comments

Comments
 (0)