Behat para position triggers en steps y en POST
This commit is contained in:
52
features/backend/step/step_update_move_position.feature
Normal file
52
features/backend/step/step_update_move_position.feature
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
http://brayan.pmos.colosa.net/api/1.0/cochalo/project/444446641528a7318e16744023753627/activity/1077328655304fcfecdf879070119988
|
||||||
|
/step/609531574530b7a20dcb7c1053135698/trigger/899405570530ba201363cf9010087072
|
||||||
|
|
||||||
|
@ProcessMakerMichelangelo @RestAPI
|
||||||
|
Feature: Step update position
|
||||||
|
Scenario: List all the Sub Processs (result 0 Sub Processs)
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And I request "project/106912358530c9b14ac15d3001790900/activity/467397212530c9b18435b87094293840/step/693874302530c9ba1734ad0026525748/trigger/659748303530c9b85af4d26007619346/before"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
And that "step_position" is set to "3"
|
||||||
|
|
||||||
|
Scenario: Change order the step
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And PUT this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"st_type": "BEFORE",
|
||||||
|
"st_position": "1"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/106912358530c9b14ac15d3001790900/activity/467397212530c9b18435b87094293840/step/693874302530c9ba1734ad0026525748/trigger/659748303530c9b85af4d26007619346"
|
||||||
|
Then the response status code should be 200
|
||||||
|
|
||||||
|
Scenario: List all the Sub Processs (result 0 Sub Processs)
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And I request "project/106912358530c9b14ac15d3001790900/activity/467397212530c9b18435b87094293840/step/693874302530c9ba1734ad0026525748/trigger/659748303530c9b85af4d26007619346/before"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
And that "step_position" is set to "1"
|
||||||
|
|
||||||
|
Scenario: Change order the step
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And PUT this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"st_type": "BEFORE",
|
||||||
|
"st_position": "3"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/106912358530c9b14ac15d3001790900/activity/467397212530c9b18435b87094293840/step/693874302530c9ba1734ad0026525748/trigger/659748303530c9b85af4d26007619346"
|
||||||
|
Then the response status code should be 200
|
||||||
|
|
||||||
|
Scenario: List all the Sub Processs (result 0 Sub Processs)
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And I request "project/106912358530c9b14ac15d3001790900/activity/467397212530c9b18435b87094293840/step/693874302530c9ba1734ad0026525748/trigger/659748303530c9b85af4d26007619346/before"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
And that "step_position" is set to "3"
|
||||||
@@ -115,18 +115,17 @@ class Trigger
|
|||||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}")));
|
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, $taskUid, "", $arrayData["st_position"])) {
|
|
||||||
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $taskUid . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Create
|
//Create
|
||||||
$stepTrigger = new \StepTrigger();
|
$stepTrigger = new \StepTrigger();
|
||||||
|
$posIni = $stepTrigger->getNextPosition($stepUid, $type, $taskUid);
|
||||||
$stepTrigger->create(array("STEP_UID" => $stepUid, "TAS_UID" => $taskUid, "TRI_UID" => $triggerUid, "ST_TYPE" => $type));
|
$stepTrigger->createRow(array(
|
||||||
|
"STEP_UID" => $stepUid,
|
||||||
if (!isset($arrayData["st_position"]) || $arrayData["st_position"] == "") {
|
"TAS_UID" => $taskUid,
|
||||||
$arrayData["st_position"] = $stepTrigger->getNextPosition($stepUid, $type, $taskUid) - 1;
|
"TRI_UID" => $triggerUid,
|
||||||
}
|
"ST_TYPE" => $type,
|
||||||
|
"ST_CONDITION" => (isset($arrayData['st_condition'])) ? $arrayData['st_condition'] : '',
|
||||||
|
"ST_POSITION" => $posIni
|
||||||
|
));
|
||||||
|
|
||||||
$arrayData = $this->update($stepUidIni, $typeIni, $taskUid, $triggerUid, $arrayData);
|
$arrayData = $this->update($stepUidIni, $typeIni, $taskUid, $triggerUid, $arrayData);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user