ProcessMaker-BE "BPMN Import (PHPUnit)"

- PHPUnit for processmaker/workflow/engine/src/ProcessMaker/Importer/XmlImporter.php
- BPMN Export, el nombre del archivo generado contiene
  el caracter guion bajo en reemplazo del caracter espacio
This commit is contained in:
Victor Saisa Lopez
2014-05-12 15:24:19 -04:00
parent 1843cae639
commit 212938d835
4 changed files with 18 additions and 20 deletions

View File

@@ -401,7 +401,7 @@ abstract class Importer
$arrayFieldNameForException = $arrayFieldName;
if (isset($_FILES[$arrayFieldName["projectFile"]])) {
$_FILES["filepmx"] = $_FILES[$arrayFieldName["projectFile"]];
$_FILES["filePmx"] = $_FILES[$arrayFieldName["projectFile"]];
}
if (isset($arrayData[$arrayFieldName["projectFile"]]) &&
@@ -418,7 +418,6 @@ abstract class Importer
$process = new \ProcessMaker\BusinessModel\Process();
$validator = new \ProcessMaker\BusinessModel\Validator();
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayFieldDefinition, $arrayFieldNameForException, true);
@@ -433,7 +432,7 @@ abstract class Importer
}
}
if ((isset($_FILES["filepmx"]) && pathinfo($_FILES["filepmx"]["name"], PATHINFO_EXTENSION) != "pmx") ||
if ((isset($_FILES["filePmx"]) && pathinfo($_FILES["filePmx"]["name"], PATHINFO_EXTENSION) != "pmx") ||
(isset($arrayData[$arrayFieldName["projectFile"]]) && pathinfo($arrayData[$arrayFieldName["projectFile"]], PATHINFO_EXTENSION) != "pmx")
) {
throw (new \Exception("The file extension not is \"pmx\""));
@@ -456,12 +455,13 @@ abstract class Importer
$option = $opt;
if (isset($_FILES["filepmx"])) {
$this->setSaveDir(PATH_DOCUMENT . "input");
$this->setSourceFromGlobals("filepmx");
if (isset($_FILES["filePmx"])) {
$this->setSourceFromGlobals("filePmx");
} else {
if (isset($arrayData[$arrayFieldName["projectFile"]]) && file_exists(PATH_DOCUMENT . "input" . PATH_SEP . $arrayData[$arrayFieldName["projectFile"]])) {
$this->setSourceFile(PATH_DOCUMENT . "input" . PATH_SEP . $arrayData[$arrayFieldName["projectFile"]]);
$filePmx = rtrim($this->getSaveDir(), PATH_SEP) . PATH_SEP . $arrayData[$arrayFieldName["projectFile"]];
if (isset($arrayData[$arrayFieldName["projectFile"]]) && file_exists($filePmx)) {
$this->setSourceFile($filePmx);
} else {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayFieldNameForException["projectFile"], $arrayData[$arrayFieldName["projectFile"]]), "The file with {0}: \"{1}\" does not exist.")));
}