PMCORE-2120
This commit is contained in:
@@ -125,4 +125,25 @@ class WorkflowTest extends TestCase
|
||||
$this->expectException(Exception::class);
|
||||
$actual = $this->workflow->getData($proUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the target xml dynaform was created correctly
|
||||
*
|
||||
* @test
|
||||
* @covers \ProcessMaker\Project\Workflow::createDataFileByArrayFile()
|
||||
*/
|
||||
public function it_review_creation_of_xml_dynaforms()
|
||||
{
|
||||
$dyna1 = [
|
||||
'file_name' => $this->faker->sentence(2),
|
||||
'file_path' => '7256532885f4e6876cc8a50043688438\\3953439805f4e689265e2b8072489041.xml',
|
||||
'file_content' => '<?xml version="1.0" encoding="UTF-8"?><dynaForm type="xmlform" name="7256532885f4e6876cc8a50043688438/3953439805f4e689265e2b8072489041" width="500" enabletemplate="0" mode="" nextstepsave="prompt"></dynaForm>',
|
||||
];
|
||||
$formatFiles = [];
|
||||
$formatFiles['dynaforms'][] = $dyna1;
|
||||
$this->workflow->createDataFileByArrayFile($formatFiles);
|
||||
$this->assertTrue(file_exists(PATH_DYNAFORM . '7256532885f4e6876cc8a50043688438/3953439805f4e689265e2b8072489041.xml'));
|
||||
// Remove the xml created
|
||||
G::rm_dir(PATH_DYNAFORM . '7256532885f4e6876cc8a50043688438/3953439805f4e689265e2b8072489041.xml');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1111,6 +1111,12 @@ class Workflow extends Handler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the workflow-files related to the process
|
||||
*
|
||||
* @param array $arrayFile
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function createDataFileByArrayFile(array $arrayFile)
|
||||
{
|
||||
try {
|
||||
@@ -1135,6 +1141,8 @@ class Workflow extends Handler
|
||||
|
||||
foreach ($files as $file) {
|
||||
$filename = $basePath . ((isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
|
||||
// If the file was created in WINDOWS we need to replace the "\\"
|
||||
$filename = str_replace("\\", "/", $filename);
|
||||
$path = dirname($filename);
|
||||
|
||||
if (!is_dir($path)) {
|
||||
|
||||
Reference in New Issue
Block a user