Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-03-20 09:07:58 -04:00
23 changed files with 394 additions and 49 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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_<case_number>"
And store "caseNumber" in session array as variable "caseNumber_<case_number>"
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"

View File

@@ -1,7 +1,7 @@
@ProcessMakerMichelangelo @RestAPI @ProcessMakerMichelangelo @RestAPI
Feature: Cases Actions - the features in this script are (inbox, draftCaseList, participatedCaseList, unassignedCaseList, pausedCaseList and advanced Search) Feature: Cases Actions - the features in this script are (inbox, draftCaseList, participatedCaseList, unassignedCaseList, pausedCaseList and advanced Search)
Requirements: 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: Background:
Given that I have a valid access_token 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 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the response has 1 records
Scenario: Returns a list of the cases for the logged in user (Draft) 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 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the response has 1 records
Scenario: Returns a list of the cases for the logged in user (Participated) 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 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the response has 9 records
Scenario: Returns a list of the cases for the logged in user (Unassigned) Scenario: Returns a list of the cases for the logged in user (Unassigned)
@@ -33,6 +36,7 @@ Scenario: Returns a list of the cases for the logged in user (Unassigned)
Then the response status code should be 200 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the response has 1 records
Scenario: Returns a list of the cases for the logged in user (Paused) Scenario: Returns a list of the cases for the logged in user (Paused)
@@ -40,3 +44,4 @@ Scenario: Returns a list of the cases for the logged in user (Paused)
Then the response status code should be 200 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the response has 1 records

View File

@@ -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 "<records>"
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 "<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 400
And the response has 4 records
And the response status message should have the following text "<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 400
And the response has 4 records
And the response status message should have the following text "<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 400
And the response has 4 records
And the response status message should have the following text "<records>"

View File

@@ -297,30 +297,11 @@ class CaseTracker
); );
} }
//Set data $arrayAvailableCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort(
\G::LoadClass("ArrayPeer"); $arrayAvailableCaseTrackerObject,
array("obj_type", "obj_title"),
global $_DBArray; SORT_ASC
);
$_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;
}
return $arrayAvailableCaseTrackerObject; return $arrayAvailableCaseTrackerObject;
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -411,27 +392,7 @@ class CaseTracker
//Set data //Set data
\G::LoadClass("ArrayPeer"); \G::LoadClass("ArrayPeer");
$arraydbCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort($arraydbCaseTrackerObject, array("cto_position"), SORT_ASC);
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;
}
return $arrayCaseTrackerObject; return $arrayCaseTrackerObject;
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -69,6 +69,10 @@ class ArrayUtil
*/ */
public static function sort($data, $columns, $direction = SORT_ASC) public static function sort($data, $columns, $direction = SORT_ASC)
{ {
if (empty($data)) {
return $data;
}
$composedData = array(); $composedData = array();
if (is_array($direction)) { if (is_array($direction)) {
@@ -92,7 +96,7 @@ class ArrayUtil
$composedData[] = & $data; $composedData[] = & $data;
if (PHP_VERSION_ID < 54000) { if (PHP_VERSION_ID < 50400) {
switch (count($columns)) { switch (count($columns)) {
case 1: array_multisort($composedData[0], $composedData[1], $composedData[2]); break; 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; case 2: array_multisort($composedData[0], $composedData[1], $composedData[2], $composedData[3], $composedData[4]); break;