mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 15:06:06 +00:00
Metadata: saveCustom() fixes
This commit is contained in:
@@ -349,7 +349,11 @@ class Metadata
|
||||
$changedData = Json::encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
$filePath = array($this->paths['customPath'], $key1, $key2.'.json');
|
||||
|
||||
return $this->getFileManager()->putContents($filePath, $changedData);
|
||||
$result = $this->getFileManager()->putContents($filePath, $changedData);
|
||||
|
||||
$this->init(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,6 +64,7 @@ class MetadataTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->object->clearChanges();
|
||||
$this->object = NULL;
|
||||
}
|
||||
|
||||
@@ -265,6 +266,8 @@ class MetadataTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testSaveCustom()
|
||||
{
|
||||
$initStatusOptions = $this->object->get('entityDefs.Lead.fields.status.options');
|
||||
|
||||
$customPath = 'tests/unit/testData/cache/metadata/custom';
|
||||
|
||||
$paths = $this->reflection->getProperty('paths');
|
||||
@@ -290,6 +293,10 @@ class MetadataTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals($data, $savedData);
|
||||
|
||||
$initStatusOptions[] = 'Test1';
|
||||
$initStatusOptions[] = 'Test2';
|
||||
$this->assertEquals($initStatusOptions, $this->object->get('entityDefs.Lead.fields.status.options'));
|
||||
|
||||
unlink($savedFile);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user