fix orm entity

This commit is contained in:
Yuri Kuznetsov
2021-04-01 11:25:57 +03:00
parent 6965591e7b
commit 110d773e3c
2 changed files with 20 additions and 2 deletions
+2 -2
View File
@@ -1006,7 +1006,7 @@ class BaseEntity implements Entity
*/
protected function cloneArray(?array $value) : ?array
{
if (!$value) {
if ($value === null) {
return null;
}
@@ -1050,7 +1050,7 @@ class BaseEntity implements Entity
*/
protected function cloneObject(?StdClass $value) : ?StdClass
{
if (!$value) {
if ($value === null) {
return null;
}
+18
View File
@@ -271,6 +271,24 @@ class EntityTest extends \PHPUnit\Framework\TestCase
}
public function testEmptyArray() : void
{
$job = $this->createEntity('Job', Job::class);
$job->set('array', []);
$this->assertEquals([], $job->get('array'));
}
public function testEmptyObject() : void
{
$job = $this->createEntity('Job', Job::class);
$job->set('object', (object) []);
$this->assertEquals((object) [], $job->get('object'));
}
public function testCloningArray() : void
{
$original = [