EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
test
Yuri Kuznetsovb668f54a686e
diff --git a/tests/unit/Espo/Core/Utils/DataUtilTest.php b/tests/unit/Espo/Core/Utils/DataUtilTest.phpindex 97c70adcf5..1e6039461a 100644--- a/tests/unit/Espo/Core/Utils/DataUtilTest.php+++ b/tests/unit/Espo/Core/Utils/DataUtilTest.php@@ -131,11 +131,11 @@ class DataUtilTest extends \PHPUnit\Framework\TestCasepublic function testUnsetRemoveEmpty(): void{$data = (object) [- 'scopeNames' => [+ 'scopeNames' => (object) ['a' => 'test','b' => 'test',],- 'scopeNamesPlural' => [+ 'scopeNamesPlural' => (object) ['a' => 'test','b' => 'test',],@@ -145,11 +145,11 @@ class DataUtilTest extends \PHPUnit\Framework\TestCase$this->assertEquals((object) [- 'scopeNames' => [+ 'scopeNames' => (object) ['a' => 'test','b' => 'test',],- 'scopeNamesPlural' => [+ 'scopeNamesPlural' => (object) ['a' => 'test','b' => 'test',],@@ -158,6 +158,37 @@ class DataUtilTest extends \PHPUnit\Framework\TestCase);}+ public function testSetByPath(): void+ {+ $data = (object) [+ 'scopeNames' => (object) [+ 'a' => 'A',+ 'b' => 'B',+ ],+ 'scopeNamesPlural' => (object) [+ 'a' => 'As',+ 'b' => 'Bs',+ ],+ ];++ DataUtil::setByPath($data, ['scopeNamesPlural', 'c'], 'Cs');++ $this->assertEquals(+ (object) [+ 'scopeNames' => (object) [+ 'a' => 'A',+ 'b' => 'B',+ ],+ 'scopeNamesPlural' => (object) [+ 'a' => 'As',+ 'b' => 'Bs',+ 'c' => 'Cs',+ ],+ ],+ $data+ );+ }+public function testUnsetByValue(){$data = json_decode('{