diff --git a/features/backend/application_cases/case_actions_13-17/basic_sequence_cases_actions_13_17.feature b/features/backend/application_cases/case_actions_13-17/basic_sequence_cases_actions_13_17.feature new file mode 100644 index 000000000..69f573cc4 --- /dev/null +++ b/features/backend/application_cases/case_actions_13-17/basic_sequence_cases_actions_13_17.feature @@ -0,0 +1,85 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Cases Actions - the features in this script are (cancelCase, pauseCase, unpaseCase, executeCase, executeCase, executeTrigger and Delete Case) +Requirements: + a workspace with five cases of the process "Test micheangelo" and "Test Users-Step-Properties End Point" + +Background: + Given that I have a valid access_token + + +Scenario: Cancel Case + Given PUT this data: + """ + { + + + + } + """ + And that I want to update a resource with the key "" stored in session array + And I request "case/{uid}/cancel-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" + + +Scenario: Pause Case + Given PUT this data: + """ + { + + + + } + """ + And that I want to update a resource with the key "" stored in session array + And I request "case/{uid}/pause-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" + + +Scenario: Unpause Case + Given PUT this data: + """ + { + + + + } + """ + And that I want to update a resource with the key "" stored in session array + And I request "case/{uid}/unpause-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" + + + +Scenario: Executes a ProcessMaker trigger for a case + Given POST this data: + """ + { + + + + } + """ + And I request "case{uid}/execute-trigger" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "" in session array + + +Scenario: Delete case of workspace + Given that I want to delete a resource with the key "" stored in session array + And I request "case/{uid}/unpause-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" diff --git a/features/backend/application_cases/case note/main_tests_case_note.feature b/features/backend/application_cases/case_actions_13-17/main_tests_cases_actions_13_17.feature similarity index 100% rename from features/backend/application_cases/case note/main_tests_case_note.feature rename to features/backend/application_cases/case_actions_13-17/main_tests_cases_actions_13_17.feature diff --git a/features/backend/application_cases/case note/negative_tests_case_note.feature b/features/backend/application_cases/case_actions_13-17/negative_tests_cases_actions_13_17.feature similarity index 100% rename from features/backend/application_cases/case note/negative_tests_case_note.feature rename to features/backend/application_cases/case_actions_13-17/negative_tests_cases_actions_13_17.feature diff --git a/features/backend/application_cases/case_actions_7-12/basic_sequence_cases_actions_7_12.feature b/features/backend/application_cases/case_actions_7-12/basic_sequence_cases_actions_7_12.feature new file mode 100644 index 000000000..a3d81314a --- /dev/null +++ b/features/backend/application_cases/case_actions_7-12/basic_sequence_cases_actions_7_12.feature @@ -0,0 +1,106 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Cases Actions - the features in this script are (getCaseInfo, taskCase, newCase, newCaseImpersonate, reassignCase and routeCase) +Requirements: + a workspace with five cases of the process "Test micheangelo" and "Test Users-Step-Properties End Point" + +Background: + Given that I have a valid access_token + + +Scenario: Returns information about a given case + Given I request "case" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the "ca_prj" property equals "ca_prj" + And the "ca_title" property equals "ca_title" + And the "ca_number" property equals "ca_number" + And the "ca_status" property equals "ca_status" + And the "ca_uid" property equals "ca_uid" + And the "ca_creator" property equals "ca_creator" + And the "ca_date" property equals "ca_date" + And the "ca_update" property equals "ca_update" + And the "ca_lastupdate" property equals "ca_lastupdate" + And the "ca_description" property equals "ca_description" + And the "ca_task" property equals "ca_task" + And the "ca_current_user" property equals "ca_current_user" + And the "ca_delegate" property equals "ca_delegate" + And the "ca_init_date" property equals "ca_init_date" + And the "ca_due_date" property equals "ca_duo_date" + And the "ca_finish_date" property equals "ca_finish_date" + + +Scenario: Returns the current task for a given case + Given I request "case/uid/current-task" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the "ca_prj" property equals "ca_prj" + + +Scenario: Create a new case in workspace with process Test Micheangelo + Given POST this data: + """ + { + + + + } + """ + And I request "case" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "" in session array + + +Scenario: Create a new case Impersonate in workspace with process Test Micheangelo + Given POST this data: + """ + { + + + + } + """ + And I request "case/impersonate" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "" in session array + + +Scenario: Reassigns a case to a different user + Given PUT this data: + """ + { + + + + } + """ + And that I want to update a resource with the key "" stored in session array + And I request "case/{uid}/reassign-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" + + +Scenario: Autoderivate a case to the next task in the process + Given PUT this data: + """ + { + + + + } + """ + And that I want to update a resource with the key "" stored in session array + And I request "case/{uid}/route-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" \ No newline at end of file diff --git a/features/backend/application_cases/case variables/main_tests_case_variables.feature b/features/backend/application_cases/case_actions_7-12/main_tests_cases_actions_7_12.feature similarity index 100% rename from features/backend/application_cases/case variables/main_tests_case_variables.feature rename to features/backend/application_cases/case_actions_7-12/main_tests_cases_actions_7_12.feature diff --git a/features/backend/application_cases/case variables/negative_tests_case_variables.feature b/features/backend/application_cases/case_actions_7-12/negative_tests_cases_actions_7_12.feature similarity index 100% rename from features/backend/application_cases/case variables/negative_tests_case_variables.feature rename to features/backend/application_cases/case_actions_7-12/negative_tests_cases_actions_7_12.feature diff --git a/features/backend/application_cases/case note/basic_sequence_case_note.feature b/features/backend/application_cases/case_note/basic_sequence_case_note.feature similarity index 100% rename from features/backend/application_cases/case note/basic_sequence_case_note.feature rename to features/backend/application_cases/case_note/basic_sequence_case_note.feature diff --git a/features/backend/application_cases/cases lists 1-6/main_tests_cases_lists_1_6.feature b/features/backend/application_cases/case_note/main_tests_case_note.feature similarity index 100% rename from features/backend/application_cases/cases lists 1-6/main_tests_cases_lists_1_6.feature rename to features/backend/application_cases/case_note/main_tests_case_note.feature diff --git a/features/backend/application_cases/cases lists 1-6/negative_tests_cases_lists_1_6.feature b/features/backend/application_cases/case_note/negative_tests_case_note.feature similarity index 100% rename from features/backend/application_cases/cases lists 1-6/negative_tests_cases_lists_1_6.feature rename to features/backend/application_cases/case_note/negative_tests_case_note.feature diff --git a/features/backend/application_cases/case variables/basic_sequence_case_variables.feature b/features/backend/application_cases/case_variables/basic_sequence_case_variables.feature similarity index 100% rename from features/backend/application_cases/case variables/basic_sequence_case_variables.feature rename to features/backend/application_cases/case_variables/basic_sequence_case_variables.feature diff --git a/features/backend/application_cases/input documents_case/main_tests_input_document_case.feature b/features/backend/application_cases/case_variables/main_tests_case_variables.feature similarity index 100% rename from features/backend/application_cases/input documents_case/main_tests_input_document_case.feature rename to features/backend/application_cases/case_variables/main_tests_case_variables.feature diff --git a/features/backend/application_cases/input documents_case/negative_tests_input_document_case.feature b/features/backend/application_cases/case_variables/negative_tests_case_variables.feature similarity index 100% rename from features/backend/application_cases/input documents_case/negative_tests_input_document_case.feature rename to features/backend/application_cases/case_variables/negative_tests_case_variables.feature diff --git a/features/backend/application_cases/cases_lists_1-6/basic_sequence_cases_lists_1_6.feature b/features/backend/application_cases/cases_lists_1-6/basic_sequence_cases_lists_1_6.feature new file mode 100644 index 000000000..44e61b055 --- /dev/null +++ b/features/backend/application_cases/cases_lists_1-6/basic_sequence_cases_lists_1_6.feature @@ -0,0 +1,144 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Cases Actions - the features in this script are (inbox, draftCaseList, participatedCaseList, unassignedCaseList, pausedCaseList and advanced Search) and (getCaseInfo, taskCase, newCase, newCaseImpersonate, reassignCase and routeCase) +Requirements: + a workspace with five of the process "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection", "Derivation rules - sequential" + +Background: + Given that I have a valid access_token + + +Scenario: Returns a list of the cases for the logged in user (Inbox) + Given I request "cases" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 1 records + + +Scenario: Returns information about a given case of the list Inbox + Given I request "cases/48177942153275bfa28bd04070312685" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the "guid" property equals "48177942153275bfa28bd04070312685" + And the "name" property equals "16" + And the "status" property equals "TO_DO" + And the "delIndex" property equals "2" + And the "processId" property equals "99209594750ec27ea338927000421575" + + +Scenario: Returns the current task for a given case of the list Inbox + Given I request "cases/48177942153275bfa28bd04070312685/current-task" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the "guid" property equals "73641967750ec281cf015d9009265327" + And the "name" property equals "Cyclical" + And the "delegate" property equals "2" + + +Scenario: Returns a list of the cases for the logged in user (Draft) + Given I request "cases/draft" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 1 records + + +Scenario: Returns a list of the cases for the logged in user (Participated) + Given I request "cases/participated" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 6 records + + +Scenario: Returns a list of the cases for the logged in user (Unassigned) + Given I request "cases/unassigned" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 1 records + + +Scenario: Returns a list of the cases for the logged in user (Paused) + Given I request "cases/paused" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 1 records + + +Scenario Outline: Create a new case in workspace with process "Derivation rules - sequential" + Given POST this data: + """ + { + "prj_uid": "99209594750ec27ea338927000421575", + "act_uid": "68707275350ec281ada1c95068712556", + "variables": [{"name": "admin", "lastname":"admin"}] + } + """ + And I request "cases" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "caseId" in session array as variable "caseId_" + And store "caseNumber" in session array as variable "caseNumber_" + + Examples: + | case_number | + | 1 | + + + +Scenario: Create a new case Impersonate in workspace with process "Derivation rules - sequential" + Given POST this data: + """ + { + "prj_uid": "99209594750ec27ea338927000421575", + "usr_uid": "24166330352d56730cdd525035621101", + "act_uid": "68707275350ec281ada1c95068712556", + "variables": [{"name": "pruebaQA", "amount":"10400"}] + } + """ + And I request "cases/impersonate" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "caseId" in session array as variable "case1" + + +Scenario: Reassigns a case to a different user + Given PUT this data: + """ + { + "del_index": "53643749052af5bdef3ca79050192707", + "usr_uid_source": "62625000752d5672d6661e6072881167", + "usr_uid_target": "24166330352d56730cdd525035621101" + } + """ + And that I want to update a resource with the key "" stored in session array + And I request "case/{uid}/reassign-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" + + +Scenario: Autoderivate a case to the next task in the process + Given PUT this data: + """ + { + "case_uid": "78ef3ca7905019270643749052af5bd7", + "del_index": "1" + } + """ + And that I want to update a resource with the key "" stored in session array + And I request "case/{uid}/route-case" + Then the response status code should be 200 + And the content type is "application/json" + And the response charset is "UTF-8" + And the type is "object" + \ No newline at end of file diff --git a/features/backend/application_cases/cases lists 1-6/basic_sequence_cases_lists_1_6.feature b/features/backend/application_cases/cases_lists_1-6/main_tests_cases_lists_1_6.feature similarity index 74% rename from features/backend/application_cases/cases lists 1-6/basic_sequence_cases_lists_1_6.feature rename to features/backend/application_cases/cases_lists_1-6/main_tests_cases_lists_1_6.feature index d4a1d8ea9..66972e103 100644 --- a/features/backend/application_cases/cases lists 1-6/basic_sequence_cases_lists_1_6.feature +++ b/features/backend/application_cases/cases_lists_1-6/main_tests_cases_lists_1_6.feature @@ -1,8 +1,8 @@ @ProcessMakerMichelangelo @RestAPI Feature: Cases Actions - the features in this script are (inbox, draftCaseList, participatedCaseList, unassignedCaseList, pausedCaseList and advanced Search) Requirements: - a workspace with five cases of the process "Test micheangelo" and "Test Users-Step-Properties End Point" - + a workspace with five of the process "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection", "Derivation rules - sequential" + Background: Given that I have a valid access_token @@ -12,6 +12,7 @@ Scenario: Returns a list of the cases for the logged in user (Inbox) Then the response status code should be 200 And the response charset is "UTF-8" And the type is "array" + And the response has 1 records Scenario: Returns a list of the cases for the logged in user (Draft) @@ -19,6 +20,7 @@ Scenario: Returns a list of the cases for the logged in user (Draft) Then the response status code should be 200 And the response charset is "UTF-8" And the type is "array" + And the response has 1 records Scenario: Returns a list of the cases for the logged in user (Participated) @@ -26,6 +28,7 @@ Scenario: Returns a list of the cases for the logged in user (Participated) Then the response status code should be 200 And the response charset is "UTF-8" And the type is "array" + And the response has 9 records Scenario: Returns a list of the cases for the logged in user (Unassigned) @@ -33,10 +36,12 @@ Scenario: Returns a list of the cases for the logged in user (Unassigned) Then the response status code should be 200 And the response charset is "UTF-8" And the type is "array" + And the response has 1 records Scenario: Returns a list of the cases for the logged in user (Paused) Given I request "cases/paused" Then the response status code should be 200 And the response charset is "UTF-8" - And the type is "array" \ No newline at end of file + And the type is "array" + And the response has 1 records \ No newline at end of file diff --git a/features/backend/application_cases/cases_lists_1-6/negative_tests_cases_lists_1_6.feature b/features/backend/application_cases/cases_lists_1-6/negative_tests_cases_lists_1_6.feature new file mode 100644 index 000000000..91314ef22 --- /dev/null +++ b/features/backend/application_cases/cases_lists_1-6/negative_tests_cases_lists_1_6.feature @@ -0,0 +1,40 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Cases Actions - the features in this script are (inbox, draftCaseList, participatedCaseList, unassignedCaseList, pausedCaseList and advanced Search) Negative Tests + +Background: + Given that I have a valid access_token + + +Scenario: Returns a list of the cases for the logged in user (Inbox) + Given I request "cases" + Then the response status code should be 400 + And the response has 4 records + And the response status message should have the following text "" + + +Scenario: Returns a list of the cases for the logged in user (Draft) + Given I request "cases/draft" + Then the response status code should be 400 + And the response has 4 records + And the response status message should have the following text "" + + +Scenario: Returns a list of the cases for the logged in user (Participated) + Given I request "cases/participated" + Then the response status code should be 400 + And the response has 4 records + And the response status message should have the following text "" + + +Scenario: Returns a list of the cases for the logged in user (Unassigned) + Given I request "cases/unassigned" + Then the response status code should be 400 + And the response has 4 records + And the response status message should have the following text "" + + +Scenario: Returns a list of the cases for the logged in user (Paused) + Given I request "cases/paused" + Then the response status code should be 400 + And the response has 4 records + And the response status message should have the following text "" \ No newline at end of file diff --git a/features/backend/application_cases/input documents_case/basic_sequence_input_document_case.feature b/features/backend/application_cases/input_documents_case/basic_sequence_input_document_case.feature similarity index 100% rename from features/backend/application_cases/input documents_case/basic_sequence_input_document_case.feature rename to features/backend/application_cases/input_documents_case/basic_sequence_input_document_case.feature diff --git a/features/backend/application_cases/output document_case/main_sequence_output_document_case.feature b/features/backend/application_cases/input_documents_case/main_tests_input_document_case.feature similarity index 100% rename from features/backend/application_cases/output document_case/main_sequence_output_document_case.feature rename to features/backend/application_cases/input_documents_case/main_tests_input_document_case.feature diff --git a/features/backend/application_cases/output document_case/negative_tests_output_document_case.feature b/features/backend/application_cases/input_documents_case/negative_tests_input_document_case.feature similarity index 100% rename from features/backend/application_cases/output document_case/negative_tests_output_document_case.feature rename to features/backend/application_cases/input_documents_case/negative_tests_input_document_case.feature diff --git a/features/backend/application_cases/output document_case/basic_sequence_output_document_case.feature b/features/backend/application_cases/output_document_case/basic_sequence_output_document_case.feature similarity index 100% rename from features/backend/application_cases/output document_case/basic_sequence_output_document_case.feature rename to features/backend/application_cases/output_document_case/basic_sequence_output_document_case.feature diff --git a/features/backend/application_cases/output_document_case/main_sequence_output_document_case.feature b/features/backend/application_cases/output_document_case/main_sequence_output_document_case.feature new file mode 100644 index 000000000..e69de29bb diff --git a/features/backend/application_cases/output_document_case/negative_tests_output_document_case.feature b/features/backend/application_cases/output_document_case/negative_tests_output_document_case.feature new file mode 100644 index 000000000..e69de29bb diff --git a/workflow/engine/src/BusinessModel/CaseTracker.php b/workflow/engine/src/BusinessModel/CaseTracker.php index 445abbc76..8dbf2a8a2 100644 --- a/workflow/engine/src/BusinessModel/CaseTracker.php +++ b/workflow/engine/src/BusinessModel/CaseTracker.php @@ -297,30 +297,11 @@ class CaseTracker ); } - //Set data - \G::LoadClass("ArrayPeer"); - - global $_DBArray; - - $_DBArray = (isset($_SESSION["_DBArray"]))? $_SESSION["_DBArray"] : ""; - $_DBArray["CASE_TRACKER_OBJECT"] = $arrayCaseTrackerObject; - - $_SESSION["_DBArray"] = $_DBArray; - - $criteria = new \Criteria("dbarray"); - - $criteria->setDBArrayTable("CASE_TRACKER_OBJECT"); - $criteria->addAscendingOrderByColumn("obj_type"); - $criteria->addAscendingOrderByColumn("obj_title"); - - $rsCriteria = \ArrayBasePeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - - while ($rsCriteria->next()) { - $row = $rsCriteria->getRow(); - - $arrayAvailableCaseTrackerObject[] = $row; - } + $arrayAvailableCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort( + $arrayAvailableCaseTrackerObject, + array("obj_type", "obj_title"), + SORT_ASC + ); return $arrayAvailableCaseTrackerObject; } catch (\Exception $e) { @@ -411,27 +392,7 @@ class CaseTracker //Set data \G::LoadClass("ArrayPeer"); - - global $_DBArray; - - $_DBArray = (isset($_SESSION["_DBArray"]))? $_SESSION["_DBArray"] : ""; - $_DBArray["CASE_TRACKER_OBJECT"] = $arraydbCaseTrackerObject; - - $_SESSION["_DBArray"] = $_DBArray; - - $criteria = new \Criteria("dbarray"); - - $criteria->setDBArrayTable("CASE_TRACKER_OBJECT"); - $criteria->addAscendingOrderByColumn("cto_position"); - - $rsCriteria = \ArrayBasePeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - - while ($rsCriteria->next()) { - $row = $rsCriteria->getRow(); - - $arrayCaseTrackerObject[] = $row; - } + $arraydbCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort($arraydbCaseTrackerObject, array("cto_position"), SORT_ASC); return $arrayCaseTrackerObject; } catch (\Exception $e) { diff --git a/workflow/engine/src/ProcessMaker/Util/ArrayUtil.php b/workflow/engine/src/ProcessMaker/Util/ArrayUtil.php index 228944fd2..679d727a2 100644 --- a/workflow/engine/src/ProcessMaker/Util/ArrayUtil.php +++ b/workflow/engine/src/ProcessMaker/Util/ArrayUtil.php @@ -69,6 +69,10 @@ class ArrayUtil */ public static function sort($data, $columns, $direction = SORT_ASC) { + if (empty($data)) { + return $data; + } + $composedData = array(); if (is_array($direction)) { @@ -92,7 +96,7 @@ class ArrayUtil $composedData[] = & $data; - if (PHP_VERSION_ID < 54000) { + if (PHP_VERSION_ID < 50400) { switch (count($columns)) { case 1: array_multisort($composedData[0], $composedData[1], $composedData[2]); break; case 2: array_multisort($composedData[0], $composedData[1], $composedData[2], $composedData[3], $composedData[4]); break;