Merge remote branch 'upstream/master'

This commit is contained in:
Marco Antonio Nina
2014-04-08 07:55:00 -04:00
29 changed files with 2180 additions and 749 deletions

View File

@@ -74,7 +74,7 @@ Scenario Outline: Create a new case in workspace with process "Derivation rules
{
"pro_uid": "<pro_uid>",
"tas_uid": "<tas_uid>",
"variables": [{"name": "admin", "lastname":"admin"}]
"variables": [{"name": "admin", "amount":"1030"}]
}
"""
And I request "cases"

View File

@@ -1,7 +1,8 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Cases Actions - the features in this script are (getCaseInfo, taskCase, newCase, newCaseImpersonate, reassignCase and routeCase)
Feature: Cases Actions - the features in this script are (getCaseInfo, taskCase, newCase, newCaseImpersonate, reassignCase, routeCase, cancelCase, pauseCase, unpauseCase, executeTrigger, DELETE Case)
Requirements:
a workspace with five cases of the process "Test micheangelo" and "Test Users-Step-Properties End Point"
a workspace with 57 cases distributed in the processes "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
@@ -48,7 +49,7 @@ Scenario: Returns a list of the cases for the logged in user (Paused)
And the response has 12 records
Scenario: Returns information about a given case of the list Inbox of process "Derivation rules - Parallel"
Scenario: Returns information about a given case of the list Inbox of process "Derivation rules - Parallel"
Given I request "cases/220090038533b0c40688174019225585"
Then the response status code should be 200
And the response charset is "UTF-8"
@@ -66,7 +67,7 @@ Scenario: Returns information about a given case of the list Inbox of process "D
Scenario: Returns the current task for a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685/current-task"
Given I request "cases/356811158533b13641ef789000630231/current-task"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
@@ -76,58 +77,49 @@ Scenario: Returns the current task for a given case of the list Inbox
Scenario Outline: Create a new case in workspace with process "Derivation rules - sequential", "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection"
Given POST this data:
"""
{
"pro_uid": "<pro_uid>",
"tas_uid": "<tas_uid>",
"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 "app_uid" in session array as variable "app_uid_<app_uid_number>"
And store "app_number" in session array as variable "app_number_<app_uid_number>"
Examples:
| Description | app_uid_number | pro_uid | tas_uid | variables |
| Create new case with process "Derivation rules - sequential" | 1 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 | |
| Create new case with process "Derivation rules - evaluation" | 2 | 46279907250ec73b9b25a78031279680 | 99371337850ec73c0a38eb6024620271 | |
| Create new case with process "Derivation rules - Parallel" | 3 | 35894775350ec7daa099378048029617 | 52838134750ec7dd0989fc0015625952 | |
| Create new case with process "Derivation rules - parallel evaluation" | 4 | 34579467750ec8d55e8b115057818502 | 89648437550ec8d593c2159010276089 | |
| Create new case with process "Derivation rules - selection" | 5 | 82458496050ec668981ecc7039804404 | 56900024450ec668e4a9243080698854 | |
Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential", "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection"
Given POST this data:
"""
{
"pro_uid": "<pro_uid>",
"usr_uid": "<usr_uid>",
"tas_uid": "<tas_uid>",
"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 "app_uid" in session array as variable "app_uid_<app_uid_number>"
And store "app_number" in session array as variable "app_number_<app_uid_number>"
Examples:
| Description | app_uid_number | pro_uid | usr_uid | tas_uid | variables |
| Create new case with process "Derivation rules - sequential" - Case Start with chris | 6 | 99209594750ec27ea338927000421575 | 24166330352d56730cdd525035621101 | 68707275350ec281ada1c95068712556 | |
| Create new case with process "Derivation rules - evaluation" - Case Start with adam | 7 | 46279907250ec73b9b25a78031279680 | 44811996752d567110634a1013636964 | 99371337850ec73c0a38eb6024620271 | |
| Create new case with process "Derivation rules - Parallel" - Case Start with aaron | 8 | 35894775350ec7daa099378048029617 | 51049032352d56710347233042615067 | 52838134750ec7dd0989fc0015625952 | |
| Create new case with process "Derivation rules - parallel evaluation"- Case Start with jeremiah | 9 | 34579467750ec8d55e8b115057818502 | 86677227852d5671f40ba25017213081 | 89648437550ec8d593c2159010276089 | |
| Create new case with process "Derivation rules - selection" - Case Start with admin | 10 | 82458496050ec668981ecc7039804404 | 62625000752d5672d6661e6072881167 | 56900024450ec668e4a9243080698854 | |
Given POST this data:
"""
{
"pro_uid": "<pro_uid>",
"tas_uid": "<tas_uid>",
"variables": [{"name": "admin", "amount":"1030"}]
}
"""
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 "app_uid" in session array as variable "app_uid_<case_number>"
And store "app_number" in session array as variable "app_number_<case_number>"
Examples:
| Description | case_number | pro_uid | tas_uid |
| Create new case with process "Derivation rules - sequential" | 1 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
| Create new case with process "Derivation rules - evaluation" | 2 | 46279907250ec73b9b25a78031279680 | 99371337850ec73c0a38eb6024620271 |
| Create new case with process "Derivation rules - Parallel" | 3 | 35894775350ec7daa099378048029617 | 52838134750ec7dd0989fc0015625952 |
| Create new case with process "Derivation rules - parallel evaluation" | 4 | 34579467750ec8d55e8b115057818502 | 89648437550ec8d593c2159010276089 |
| Create new case with process "Derivation rules - selection" | 5 | 82458496050ec668981ecc7039804404 | 56900024450ec668e4a9243080698854 |
| Create new case with process "Derivation rules - sequential" | 6 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
| Create new case with process "Derivation rules - evaluation" | 7 | 46279907250ec73b9b25a78031279680 | 99371337850ec73c0a38eb6024620271 |
| Create new case with process "Derivation rules - Parallel" | 8 | 35894775350ec7daa099378048029617 | 52838134750ec7dd0989fc0015625952 |
| Create new case with process "Derivation rules - parallel evaluation" | 9 | 34579467750ec8d55e8b115057818502 | 89648437550ec8d593c2159010276089 |
| Create new case with process "Derivation rules - selection" | 10 | 82458496050ec668981ecc7039804404 | 56900024450ec668e4a9243080698854 |
| Create new case with process "Derivation rules - sequential" | 11 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
| Create new case with process "Derivation rules - evaluation" | 12 | 46279907250ec73b9b25a78031279680 | 99371337850ec73c0a38eb6024620271 |
| Create new case with process "Derivation rules - Parallel" | 13 | 35894775350ec7daa099378048029617 | 52838134750ec7dd0989fc0015625952 |
| Create new case with process "Derivation rules - parallel evaluation" | 14 | 34579467750ec8d55e8b115057818502 | 89648437550ec8d593c2159010276089 |
| Create new case with process "Derivation rules - selection" | 15 | 82458496050ec668981ecc7039804404 | 56900024450ec668e4a9243080698854 |
| Create new case with process "Derivation rules - sequential" | 16 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
| Create new case with process "Derivation rules - evaluation" | 17 | 46279907250ec73b9b25a78031279680 | 99371337850ec73c0a38eb6024620271 |
| Create new case with process "Derivation rules - Parallel" | 18 | 35894775350ec7daa099378048029617 | 52838134750ec7dd0989fc0015625952 |
| Create new case with process "Derivation rules - parallel evaluation" | 19 | 34579467750ec8d55e8b115057818502 | 89648437550ec8d593c2159010276089 |
| Create new case with process "Derivation rules - selection" | 20 | 82458496050ec668981ecc7039804404 | 56900024450ec668e4a9243080698854 |
| Create new case with process "Derivation rules - sequential" | 21 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
| Create new case with process "Derivation rules - evaluation" | 22 | 46279907250ec73b9b25a78031279680 | 99371337850ec73c0a38eb6024620271 |
| Create new case with process "Derivation rules - Parallel" | 23 | 35894775350ec7daa099378048029617 | 52838134750ec7dd0989fc0015625952 |
| Create new case with process "Derivation rules - parallel evaluation" | 24 | 34579467750ec8d55e8b115057818502 | 89648437550ec8d593c2159010276089 |
| Create new case with process "Derivation rules - selection" | 25 | 82458496050ec668981ecc7039804404 | 56900024450ec668e4a9243080698854 |
Scenario: Returns a list of the cases for the logged in user (Draft)
@@ -135,7 +127,34 @@ 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 11 records
And the response has 30 records
Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential", "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection"
Given POST this data:
"""
{
"pro_uid": "99209594750ec27ea338927000421575",
"usr_uid": "<usr_uid>",
"tas_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 "app_uid" in session array as variable "app_uid_<case_number>"
And store "app_number" in session array as variable "app_number_<case_number>"
Examples:
| Description | case_number | usr_uid |
| Create new case with process "Derivation rules - sequential" - Case Start with chris | 26 | 51049032352d56710347233042615067 |
| Create new case with process "Derivation rules - evaluation" - Case Start with adam | 27 | 44811996752d567110634a1013636964 |
| Create new case with process "Derivation rules - Parallel" - Case Start with aaron | 28 | 24166330352d56730cdd525035621101 |
| Create new case with process "Derivation rules - parallel evaluation"- Case Start with jeremiah | 29 | 86677227852d5671f40ba25017213081 |
| Create new case with process "Derivation rules - selection" - Case Start with admin | 30 | 62625000752d5672d6661e6072881167 |
Scenario Outline: Reassigns a case to a different user
@@ -143,24 +162,129 @@ Scenario Outline: Reassigns a case to a different user
"""
{
"usr_uid_source": "<usr_uid_source>",
"usr_uid_target": "<usr_uid_target>",
"usr_uid_target": "<usr_uid_target>"
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "cases/app_uid/reassign-case" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
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"
And I request "cases/app_uid/reassign-case" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
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"
Examples:
| test_description | case_number | usr_uid_source | usr_uid_target |
| Reassign the user adam | 1 | 00000000000000000000000000000001 | 44811996752d567110634a1013636964 |
| Reassign the user aaron | 2 | 00000000000000000000000000000001 | 51049032352d56710347233042615067 |
| Reassign the user jeremiah | 3 | 00000000000000000000000000000001 | 86677227852d5671f40ba25017213081 |
| Reassign the user chris | 4 | 00000000000000000000000000000001 | 24166330352d56730cdd525035621101 |
| Reassign the user zachary | 5 | 00000000000000000000000000000001 | 62625000752d5672d6661e6072881167 |
| Reassign the user admin | 26 | 99209594750ec27ea338927000421575 | 00000000000000000000000000000001 |
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 30 records
Scenario Outline: Returns the variables can be system variables and/or case variables.
Given I request "cases/app_uid/variables" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "object"
And the "ar" property equals ""
And the "br" property equals ""
And the "ba" property equals ""
Examples:
| test_description | case_number |
| Derivate case of the process "Derivation rules - sequential" | 6 |
Scenario Outline: Sends variables to a case
Given PUT this data:
"""
{
"continue": "yes",
"tasks": "Cyclical"
}
"""
And I request "cases/app_uid/variable" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
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"
Examples:
| test_description | case_number |
| Derivate case of the process "Derivation rules - sequential" | 6 |
| Derivate case of the process "Derivation rules - evaluation" | 7 |
| Derivate case of the process "Derivation rules - Parallel" | 8 |
| Derivate case of the process "Derivation rules - parallel evaluation" | 9 |
| Derivate case of the process "Derivation rules - selection" | 10 |
| Derivate case of the process "Derivation rules - evaluation" | 27 |
Scenario Outline: Route a case to the next task in the process
Given PUT this data:
"""
{
"case_uid": "<case_number>",
"del_index": "1"
}
"""
And I request "cases/app_uid/route-case" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
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"
Examples:
| test_description | case_number |
| Derivate case of the process "Derivation rules - sequential" | 6 |
| Derivate case of the process "Derivation rules - evaluation" | 7 |
| Derivate case of the process "Derivation rules - Parallel" | 8 |
| Derivate case of the process "Derivation rules - parallel evaluation" | 9 |
| Derivate case of the process "Derivation rules - selection" | 10 |
| Derivate case of the process "Derivation rules - evaluation" | 27 |
Scenario Outline: Returns the variables can be system variables and/or case variables.
Given I request "cases/app_uid/variables" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "object"
| Description | app_uid_number | usr_uid_source | usr_uid_target |
| Reassign the user adam | 1 | 00000000000000000000000000000001 | 44811996752d567110634a1013636964 |
| Reassign the user aaron | 2 | 00000000000000000000000000000001 | 51049032352d56710347233042615067 |
| Reassign the user admin | 6 | 24166330352d56730cdd525035621101 | 00000000000000000000000000000001 |
| Reassign the user admin | 7 | 44811996752d567110634a1013636964 | 00000000000000000000000000000001 |
And the "ar" property equals "OK"
And the "br" property equals "OK"
And the "ba" property equals "OK"
Examples:
| test_description | case_number |
| Derivate case of the process "Derivation rules - sequential" | 6 |
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 18 records
Scenario Outline: Cancel a case
Given PUT this data:
@@ -169,8 +293,7 @@ Scenario Outline: Cancel a case
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "cases/app_uid/cancel" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
And I request "cases/app_uid/cancel" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
@@ -178,21 +301,23 @@ Scenario Outline: Cancel a case
Examples:
| Description | app_uid_number |
| Cancel of the process "Derivation rules - Parallel" | 3 |
| Cancel of the process "Derivation rules - parallel evaluation" | 5 |
| Cancel of the process "Derivation rules - selection" | 10 |
| Description | case_number |
| Cancel of the process "Derivation rules - sequential" | 11 |
| Cancel of the process "Derivation rules - evaluation" | 12 |
| Cancel of the process "Derivation rules - Parallel" | 13 |
| Cancel of the process "Derivation rules - parallel evaluation" | 14 |
| Cancel of the process "Derivation rules - selection" | 15 |
| Cancel of the process "Derivation rules - Parallel" | 28 |
Scenario Outline: Pause a case
Given PUT this data:
"""
{
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "cases/app_uid/pause" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
{
"unpaused_date": "2016-12-12"
}
"""
And I request "cases/app_uid/pause" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
@@ -200,10 +325,21 @@ Scenario Outline: Pause a case
Examples:
| Description | app_uid_number |
| Pause of the process "Derivation rules - parallel evaluation" | 4 |
| Pause of the process "Derivation rules - Parallel" | 8 |
| Pause of the process "Derivation rules - parallel evaluation" | 9 |
| Description | case_number |
| Pause of the process "Derivation rules - sequential" | 16 |
| Pause of the process "Derivation rules - evaluation" | 17 |
| Pause of the process "Derivation rules - Parallel" | 18 |
| Pause of the process "Derivation rules - parallel evaluation" | 19 |
| Pause of the process "Derivation rules - selection" | 20 |
| Pause of the process "Derivation rules - parallel evaluation" | 29 |
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 17 records
Scenario Outline: Unpause a case
@@ -213,8 +349,7 @@ Scenario Outline: Unpause a case
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "cases/app_uid/unpause" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
And I request "cases/app_uid/unpause" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
@@ -222,84 +357,130 @@ Scenario Outline: Unpause a case
Examples:
| Description | app_uid_number |
| Unpause of the process "Derivation rules - parallel evaluation" | 4 |
| Unpause of the process "Derivation rules - Parallel" | 8 |
| Unpause of the process "Derivation rules - parallel evaluation" | 9 |
| Description | case_number |
| Unpause of the process "Derivation rules - sequential" | 16 |
| Unpause of the process "Derivation rules - evaluation" | 17 |
| Unpause of the process "Derivation rules - Parallel" | 18 |
| Unpause of the process "Derivation rules - parallel evaluation" | 19 |
| Unpause of the process "Derivation rules - selection" | 20 |
| Unpause of the process "Derivation rules - parallel evaluation" | 29 |
Scenario Outline: Trigger a case
Given PUT this data:
"""
{
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "cases/app_uid/execute-trigger/{tri_uid}" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
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 content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
Examples:
| Description | app_uid_number |
| | |
| | |
| | |
And the type is "array"
And the response has 12 records
Scenario Outline: Route a case to the next task in the process
Scenario Outline: Executes a ProcessMaker trigger for a case
Given PUT this data:
"""
{
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "case/app_uid/route-case" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
And I request "cases/app_uid/execute-trigger/<tri_uid>" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
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"
And the type is "object"
Examples:
| Description | app_uid_number |
| Route next activity "Derivation rules - sequential" | 1 |
| Route next activity "Derivation rules - evaluation" | 2 |
| Route next activity "Derivation rules - Parallel" | 3 |
| Route next activity "Derivation rules - parallel evaluation" | 4 |
| Route next activity "Derivation rules - selection" | 5 |
| Route next activity "Derivation rules - sequential" | 6 |
| Route next activity "Derivation rules - evaluation" | 7 |
| Route next activity "Derivation rules - Parallel" | 8 |
| Route next activity "Derivation rules - parallel evaluation" | 9 |
| Route next activity "Derivation rules - selection" | 10 |
| test_description | case_number | tri_uid |
| Ejecucion de trigger | 5 | 54962158250ec613ba5bc89016850103 |
Scenario Outline: Delete a case
Given PUT this data:
"""
{
}
"""
And that I want to delete a resource with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
And I request "cases"
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 Outline: Delete of the cases created in this script.
Given that I want to delete a resource with the key "app_doc_uid" stored in session array as variable "app_doc_uid_<app_doc_uid_number>"
And I request "cases/551390121533343ee886813057396196/output-document"
And the response status code should be 200
And the content type is "application/json"
Examples:
| test_description | case_number |
| Delete a case 1, created in this script | 1 |
| Delete a case 2, created in this script | 2 |
| Delete a case 3, created in this script | 3 |
| Delete a case 4, created in this script | 4 |
| Delete a case 5, created in this script | 5 |
| Delete a case 6, created in this script | 6 |
| Delete a case 7, created in this script | 7 |
| Delete a case 8, created in this script | 8 |
| Delete a case 9, created in this script | 9 |
| Delete a case 10, created in this script | 10 |
| Delete a case 11, created in this script | 11 |
| Delete a case 12, created in this script | 12 |
| Delete a case 13, created in this script | 13 |
| Delete a case 14, created in this script | 14 |
| Delete a case 15, created in this script | 15 |
| Delete a case 16, created in this script | 16 |
| Delete a case 17, created in this script | 17 |
| Delete a case 18, created in this script | 18 |
| Delete a case 19, created in this script | 19 |
| Delete a case 20, created in this script | 20 |
| Delete a case 21, created in this script | 21 |
| Delete a case 22, created in this script | 22 |
| Delete a case 23, created in this script | 23 |
| Delete a case 24, created in this script | 24 |
| Delete a case 25, created in this script | 25 |
| Delete a case 26, created in this script | 26 |
| Delete a case 27, created in this script | 27 |
| Delete a case 28, created in this script | 28 |
| Delete a case 29, created in this script | 29 |
| Delete a case 30, created in this script | 30 |
#Listado de casos
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 "object"
And the type is "array"
And the response has 14 records
Examples:
| app_doc_uid_number |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
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 15 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 30 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 12 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 12 records

View File

@@ -0,0 +1,123 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Cases Actions - the features in this script are (getCaseInfo, taskCase, newCase, newCaseImpersonate, reassignCase, routeCase, cancelCase, pauseCase, unpauseCase, executeTrigger and DELETE Case) Negative Tests
Background:
Given that I have a valid access_token
Scenario Outline: Create a new case (Negative Test)
Given POST this data:
"""
{
"pro_uid": "<pro_uid>",
"tas_uid": "<tas_uid>",
"variables": [{"name": "admin", "amount":"1030"}]
}
"""
And I request "cases"
Then the response status code should be <error_code>
And the response status message should have the following text "<error_message>"
Examples:
| Description | pro_uid | tas_uid | error_code | error_message |
| Create new case with pro_uid wrong | 99209594750ec1111111927000421575 | 68707275350ec281ada1c95068712556 | 400 | pro_uid |
| Create new case with task_uid wrong | 46279907250ec73b9b25a78031279680 | 99371337811111111111116024620271 | 400 | task_uid |
| Create new case without pro_uid | | 52838134750ec7dd0989fc0015625952 | 400 | pro_uid |
| Create new case without tas_uid | 34579467750ec8d55e8b115057818502 | | 400 | task_uid |
| Create new case whith pro_uid and tas_uid wrong | 8245849601111111181ecc7039804404 | 5690001111111118e4a9243080698854 | 400 | pro_uid |
Scenario Outline: Create a new case Impersonate (Negative Test)
Given POST this data:
"""
{
"pro_uid": "99209594750ec27ea338927000421575",
"usr_uid": "<usr_uid>",
"tas_uid": "68707275350ec281ada1c95068712556",
"variables": [{"name": "pruebaQA", "amount":"10400"}]
}
"""
And I request "cases/impersonate"
Then the response status code should be <error_code>
And the response status message should have the following text "<error_message>"
Examples:
| Description | case_number | usr_uid | error_code | error_message |
| Create new case with process "Derivation rules - sequential" - Case Start with chris | 26 | 51049032352d56710347233042615067 | 400 | pro_uid |
| Create new case with process "Derivation rules - evaluation" - Case Start with adam | 27 | 44811996752d567110634a1013636964 | 400 | task_uid |
| Create new case with process "Derivation rules - Parallel" - Case Start with aaron | 28 | 24166330352d56730cdd525035621101 | 400 | pro_uid |
| Create new case with process "Derivation rules - parallel evaluation"- Case Start with jeremiah | 29 | 86677227852d5671f40ba25017213081 | 400 | task_uid |
| Create new case with process "Derivation rules - selection" - Case Start with admin | 30 | 62625000752d5672d6661e6072881167 | 400 | |
Scenario Outline: Create a case, derivate and cancel. then try do pause or route
#Create case
Given POST this data:
"""
{
"pro_uid": "<pro_uid>",
"tas_uid": "<tas_uid>",
"variables": [{"name": "admin", "amount":"1030"}]
}
"""
And I request "cases"
Then the response status code should be 200
And store "app_uid" in session array as variable "app_uid_<case_number>"
#Send some variables
And PUT this data:
"""
{
"continue": "yes",
"tasks": "Cyclical"
}
"""
And I request "cases/app_uid/variable" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
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"
#Cancel case
And PUT this data:
"""
{
}
"""
And I request "cases/app_uid/cancel" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
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"
#Route case: it should not allow
And PUT this data:
"""
{
"case_uid": "<case_number>",
"del_index": "1"
}
"""
And I request "cases/app_uid/route-case" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
Then the response status code should be 400
And the response status message should have the following text "<error_message_route>"
#Pause case
And PUT this data:
"""
{
"unpaused_date": "2016-12-12"
}
"""
And I request "cases/app_uid/pause" with the key "app_uid" stored in session array as variable "app_uid_<case_number>"
Then the response status code should be 400
And the response status message should have the following text "<error_message_pause>"
Examples:
| Description | case_number | pro_uid | tas_uid | error_message_route | error_message_pause |
| Create new case with process "Derivation rules - sequential" | 1 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 | This case delegation is already closed | This case delegation is already closed |

View File

@@ -9,6 +9,7 @@ Background:
Scenario: List of case notes for this case
Given I request "cases/1185553665335d2e209f723099733152/notes"
the response time should at least be (\d+) milliseconds$/
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
@@ -30,7 +31,7 @@ Scenario: Create a new case note for specified case
}
"""
And I request "cases/1185553665335d2e209f723099733152/note"
Then the response status code should be 201
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"

View File

@@ -8,7 +8,7 @@ Background:
Scenario: List of case notes for this case
Given I request "cases/{uid}/notes"
Given I request "cases/1185553665335d2e209f723099733152/notes"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
@@ -22,7 +22,7 @@ Scenario: Create a new case note for specified case
"send_email": 1
}
"""
And I request "case/{uid}/case"
And I request "case/1185553665335d2e209f723099733152/case"
Then the response status code should be 201
And the response charset is "UTF-8"
And the content type is "application/json"

View File

@@ -47,32 +47,32 @@ Scenario: Returns the variables can be system variables and/or case variables.
And the "date4" property equals "2014-03-01"
And the "suggest2" property equals "51049032352d56710347233042615067"
And the "suggest2_label" property equals "aaron"
And the "sample" property in row 1 of property "grid" equals "jose"
And the "currency1" property equals "12,334,444.00"
And the "percentage1" property equals "333.00 %"
And the "suggest1_label" property equals "gavin"
And the "suggest1" property equals "33140476452d5671b0abda5073786635"
And the "textarea1" property equals "ninguno"
And the "dropdown1" property equals "dos"
And the "dropdown1_label" property equals "dos"
And the "yesno1" property equals "1"
And the "checkbox1" property equals "On"
And the "date1" property equals "2014-03-13"
And the "link1" property equals "http://www.google.com/"
And the "link1_label" property equals "link1"
And the "sample" property equals "maria"
And the "currency1" property equals "132,424.00"
And the "percentage1" property equals "344.00 %"
And the "suggest1_label" property equals "emily"
And the "suggest1" property equals "34289569752d5673d310e82094574281"
And the "textarea1" property equals "sample"
And the "dropdown1" property equals "uno"
And the "dropdown1_label" property equals "uno"
And the "yesno1" property equals "0"
And the "checkbox1" property equals "Off"
And the "date1" property equals "2014-03-29"
And the "link1" property equals "http://www.google.com/"
And the "link1_label" property equals "link1"
And the "sample" property in object 1 of property "grid" equals "jose"
And the "currency1" property in object 1 of property "grid" equals "12,334,444.00"
And the "percentage1" property in object 1 of property "grid" equals "333.00 %"
And the "suggest1_label" property in object 1 of property "grid" equals "gavin"
And the "suggest1" property in object 1 of property "grid" equals "33140476452d5671b0abda5073786635"
And the "textarea1" property in object 1 of property "grid" equals "ninguno"
And the "dropdown1" property in object 1 of property "grid" equals "dos"
And the "dropdown1_label" property in object 1 of property "grid" equals "dos"
And the "yesno1" property in object 1 of property "grid" equals "1"
And the "checkbox1" property in object 1 of property "grid" equals "On"
And the "date1" property in object 1 of property "grid" equals "2014-03-13"
And the "link1" property in object 1 of property "grid" equals "http://www.google.com/"
And the "link1_label" property in object 1 of property "grid" equals "link1"
And the "sample" property in object 2 of property "grid" equals "maria"
And the "currency1" property in object 2 of property "grid" equals "132,424.00"
And the "percentage1" property in object 2 of property "grid" equals "344.00 %"
And the "suggest1_label" property in object 2 of property "grid" equals "emily"
And the "suggest1" property in object 2 of property "grid" equals "34289569752d5673d310e82094574281"
And the "textarea1" property in object 2 of property "grid" equals "sample"
And the "dropdown1" property in object 2 of property "grid" equals "uno"
And the "dropdown1_label" property in object 2 of property "grid" equals "uno"
And the "yesno1" property in object 2 of property "grid" equals "0"
And the "checkbox1" property in object 2 of property "grid" equals "Off"
And the "date1" property in object 2 of property "grid" equals "2014-03-29"
And the "link1" property in object 2 of property "grid" equals "http://www.google.com/"
And the "link1_label" property in object 2 of property "grid" equals "link1"
Scenario: Sends variables to a case
@@ -243,29 +243,29 @@ Scenario: Returns the variables can be system variables and/or case variables.
And the "date4" property equals "2014-03-01"
And the "suggest2" property equals "51049032352d56710347233042615067"
And the "suggest2_label" property equals "aaron"
And the "sample" property equals "jose"
And the "currency1" property equals "12,334,444.00"
And the "percentage1" property equals "333.00 %"
And the "suggest1_label" property equals "gavin"
And the "suggest1" property equals "33140476452d5671b0abda5073786635"
And the "textarea1" property equals "ninguno"
And the "dropdown1" property equals "dos"
And the "dropdown1_label" property equals "dos"
And the "yesno1" property equals "1"
And the "checkbox1" property equals "On"
And the "date1" property equals "2014-03-13"
And the "link1" property equals "http://www.google.com/"
And the "link1_label" property equals "link1"
And the "sample" property equals "maria"
And the "currency1" property equals "132,424.00"
And the "percentage1" property equals "344.00 %"
And the "suggest1_label" property equals "emily"
And the "suggest1" property equals "34289569752d5673d310e82094574281"
And the "textarea1" property equals "sample"
And the "dropdown1" property equals "uno"
And the "dropdown1_label" property equals "uno"
And the "yesno1" property equals "0"
And the "checkbox1" property equals "Off"
And the "date1" property equals "2014-03-29"
And the "link1" property equals "http://www.google.com/"
And the "link1_label" property equals "link1"
And the "sample" property in object 1 of property "grid" equals "jose"
And the "currency1" property in object 1 of property "grid" equals "12,334,444.00"
And the "percentage1" property in object 1 of property "grid" equals "333.00 %"
And the "suggest1_label" property in object 1 of property "grid" equals "gavin"
And the "suggest1" property in object 1 of property "grid" equals "33140476452d5671b0abda5073786635"
And the "textarea1" property in object 1 of property "grid" equals "ninguno"
And the "dropdown1" property in object 1 of property "grid" equals "dos"
And the "dropdown1_label" property in object 1 of property "grid" equals "dos"
And the "yesno1" property in object 1 of property "grid" equals "1"
And the "checkbox1" property in object 1 of property "grid" equals "On"
And the "date1" property in object 1 of property "grid" equals "2014-03-13"
And the "link1" property in object 1 of property "grid" equals "http://www.google.com/"
And the "link1_label" property in object 1 of property "grid" equals "link1"
And the "sample" property in object 1 of property "grid" equals "maria"
And the "currency1" property in object 1 of property "grid" equals "132,424.00"
And the "percentage1" property in object 1 of property "grid" equals "344.00 %"
And the "suggest1_label" property in object 1 of property "grid" equals "emily"
And the "suggest1" property in object 1 of property "grid" equals "34289569752d5673d310e82094574281"
And the "textarea1" property in object 1 of property "grid" equals "sample"
And the "dropdown1" property in object 1 of property "grid" equals "uno"
And the "dropdown1_label" property in object 1 of property "grid" equals "uno"
And the "yesno1" property in object 1 of property "grid" equals "0"
And the "checkbox1" property in object 1 of property "grid" equals "Off"
And the "date1" property in object 1 of property "grid" equals "2014-03-29"
And the "link1" property in object 1 of property "grid" equals "http://www.google.com/"
And the "link1_label" property in object 1 of property "grid" equals "link1"

View File

@@ -65,8 +65,8 @@ Scenario Outline: Get paging of list inbox
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "array"
And the response has <records> records
And the type is "object"
And the response has <records> records in property "data"
Examples:
@@ -88,7 +88,7 @@ Scenario Outline: Get paging of list inbox
| start equals zero | 0 | 20 | 14 | 200 |
| search 0 | 0 | 0 | 14 | 200 |
| search 0 | 0 | 100 | 14 | 200 |
| negative numbers in start | -10 | 25 | 4 | 200 |
| negative numbers in start | -10 | 25 | 5 | 200 |
| negative numbers in limit | 1 | -25 | 14 | 200 |
| real numbers | 0.0 | 1.0 | 1 | 200 |
| real numbers in start | 0.0 | 12 | 12 | 200 |
@@ -154,8 +154,8 @@ Scenario Outline: Get order type of Search of number the process
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | 3 |
| Filter all cases | | 4 |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 18 | 1 |
| Filter all cases | | 14 |
Scenario: Returns a list of the cases for the logged in user (Draft)
@@ -171,8 +171,8 @@ Scenario Outline: Get paging of list Draft
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "array"
And the response has <records> records
And the type is "object"
And the response has <records> records in property "data"
Examples:
@@ -193,7 +193,7 @@ Scenario Outline: Get paging of list Draft
| start equals zero | 0 | 20 | 15 | 200 |
| search 0 | 0 | 0 | 15 | 200 |
| search 0 | 0 | 100 | 15 | 200 |
| negative numbers in start | -10 | 25 | 5 | 200 |
| negative numbers in start | -10 | 25 | 6 | 200 |
| negative numbers in limit | 1 | -25 | 15 | 200 |
| real numbers | 0.0 | 1.0 | 1 | 200 |
| real numbers in start | 0.0 | 12 | 12 | 200 |
@@ -230,7 +230,7 @@ Scenario Outline: Get order type of Process Category
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 9 |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 8 |
| Filter all categories | | 15 |
@@ -245,7 +245,7 @@ Scenario Outline: Get order type of Process
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | 2 |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | 1 |
| Filter all cases | | 15 |
@@ -260,7 +260,7 @@ Scenario Outline: Get order type of Search of the process
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | 4 |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 16 | 4 |
| Filter all cases | | 15 |
@@ -276,8 +276,8 @@ Scenario Outline: Get paging of list Participated
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "array"
And the response has <records> records
And the type is "object"
And the response has <records> records in property "data"
Examples:
@@ -295,7 +295,7 @@ Scenario Outline: Get paging of list Participated
| empty string | 1 | 10000 | 30 | 200 |
| invalid start | b | 25 | 25 | 200 |
| invalid limit | 1 | c | 30 | 200 |
| start equals zero | 0 | 20 | 30 | 200 |
| start equals zero | 0 | 20 | 20 | 200 |
| search 0 | 0 | 0 | 30 | 200 |
| search 0 | 0 | 100 | 30 | 200 |
| negative numbers in start | -10 | 25 | 15 | 200 |
@@ -304,7 +304,7 @@ Scenario Outline: Get paging of list Participated
| real numbers in start | 0.0 | 12 | 12 | 200 |
| real numbers in limit | 1 | 1.4599 | 1 | 200 |
| only start | 1 | | 30 | 200 |
| only limit | | 25 | 30 | 200 |
| only limit | | 25 | 25 | 200 |
| without start and limit | | | 30 | 200 |
@@ -335,7 +335,7 @@ Scenario Outline: Get order type of Process Category
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 27 |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 26 |
| Filter all categories | | 30 |
@@ -350,7 +350,7 @@ Scenario Outline: Get order type of Process
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | 3 |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | 2 |
| Filter all cases | | 30 |
@@ -366,7 +366,7 @@ Scenario Outline: Get order type of Search
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | 3 |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 17 | 10 |
| Filter all cases | | 30 |
@@ -379,12 +379,12 @@ Scenario: Returns a list of the cases for the logged in user (Unassigned)
Scenario Outline: Get paging of list Unassigned
Given I request "cases/Unassigned/paged?start=<start>&limit=<limit>"
Given I request "cases/unassigned/paged?start=<start>&limit=<limit>"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "array"
And the response has <records> records
And the type is "object"
And the response has <records> records in property "data"
Examples:
@@ -405,7 +405,7 @@ Scenario Outline: Get paging of list Unassigned
| start equals zero | 0 | 20 | 12 | 200 |
| search 0 | 0 | 0 | 12 | 200 |
| search 0 | 0 | 100 | 12 | 200 |
| negative numbers in start | -10 | 25 | 2 | 200 |
| negative numbers in start | -10 | 25 | 3 | 200 |
| negative numbers in limit | 1 | -25 | 12 | 200 |
| real numbers | 0.0 | 1.0 | 1 | 200 |
| real numbers in start | 0.0 | 12 | 12 | 200 |
@@ -471,7 +471,7 @@ Scenario Outline: Get order type of Search
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | 3 |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 16 | 1 |
| Filter all cases | | 12 |
@@ -511,7 +511,7 @@ Scenario Outline: Get paging of list Paused
| start equals zero | 0 | 20 | 12 | 200 |
| search 0 | 0 | 0 | 12 | 200 |
| search 0 | 0 | 100 | 12 | 200 |
| negative numbers in start | -10 | 25 | 2 | 200 |
| negative numbers in start | -10 | 25 | 3 | 200 |
| negative numbers in limit | 1 | -25 | 12 | 200 |
| real numbers | 0.0 | 1.0 | 1 | 200 |
| real numbers in start | 0.0 | 12 | 12 | 200 |
@@ -577,7 +577,7 @@ Scenario Outline: Get order type of Search
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | 2 |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 16 | 4 |
| Filter all cases | | 12 |
@@ -594,8 +594,8 @@ Scenario Outline: Get paging of list Advanced Search
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "array"
And the response has <records> records
And the type is "object"
And the response has <records> records in property "data"
Examples:
@@ -611,7 +611,7 @@ Scenario Outline: Get paging of list Advanced Search
| high number for start | 1000 | 0 | 0 | 200 |
| empty result | 1 | 0 | 30 | 200 |
| empty string | 1 | 10000 | 30 | 200 |
| invalid start | b | 25 | 30 | 200 |
| invalid start | b | 25 | 25 | 200 |
| invalid limit | 1 | c | 30 | 200 |
| start equals zero | 0 | 20 | 20 | 200 |
| search 0 | 0 | 0 | 30 | 200 |
@@ -622,7 +622,7 @@ Scenario Outline: Get paging of list Advanced Search
| real numbers in start | 0.0 | 12 | 12 | 200 |
| real numbers in limit | 1 | 1.4599 | 1 | 200 |
| only start | 1 | | 30 | 200 |
| only limit | | 25 | 30 | 200 |
| only limit | | 25 | 25 | 200 |
| without start and limit | | | 30 | 200 |
@@ -652,7 +652,7 @@ Scenario Outline: Get order type of Process Category
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 25 |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 26 |
| Filter all categories | | 30 |
@@ -668,7 +668,7 @@ Scenario Outline: Get order type of Process
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | 3 |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | 2 |
| Filter all cases | | 30 |
@@ -684,8 +684,8 @@ Scenario Outline: Get order type of Search
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | 2 |
| Filter all cases | | 2 |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 17 | 10 |
| Filter all cases | | 30 |
Scenario Outline: Get order for Status
@@ -699,10 +699,10 @@ Scenario Outline: Get order for Status
Examples:
| test_description | app_status | records |
| Filter Status = All Status | | 25 |
| Filter Status = All Status | | 30 |
| Filter Status = Completed | COMPLETED | 2 |
| Filter Status = Draft | DRAFT | 15 |
| Filter Status = To Do | TO_DO | 25 |
| Filter Status = To Do | TO_DO | 30 |
Scenario Outline: Get order for User
@@ -716,10 +716,10 @@ Scenario Outline: Get order for User
Examples:
| test_description | usr_uid | records |
| Filter Status = All User | | 25 |
| Filter Status = aaron | 51049032352d56710347233042615067 | 2 |
| Filter Status = admin | 00000000000000000000000000000001 | 2 |
| Filter Status = chris | 24166330352d56730cdd525035621101 | 2 |
| Filter Status = All User | | 30 |
| Filter Status = aaron | 51049032352d56710347233042615067 | 4 |
| Filter Status = admin | 00000000000000000000000000000001 | 30 |
| Filter Status = chris | 24166330352d56730cdd525035621101 | 6 |
Scenario Outline: Get order for date
@@ -734,4 +734,4 @@ Scenario Outline: Get order for date
| test_description | date_from | date_to | records |
| Filter date = 2014-03-01 | 2014-03-01 | 2014-03-31 | 5 |
| Filter date = 2014-03-15 | 2014-03-15 | 2014-04-01 | 25 |
| Filter date = 2014-03-15 | 2014-03-15 | 2014-04-01 | 30 |

View File

@@ -4,43 +4,38 @@ Feature: Cases Actions - the features in this script are (inbox, draftCaseList,
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"
Scenario: Get paging of list inbox (Negative Test)
Given I request "cases/pawdd?start=4&limit=10"
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"
And the response status message should have the following text "app_uid"
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: Get paging of list inbox (Negative Test)
Given I request "cases/draft/pawdd?start=4&limit=10"
Then the response status code should be 404
And the response status message should have the following text "Not Found"
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: Get paging of list inbox (Negative Test)
Given I request "cases/participated/pawdd?start=4&limit=10"
Then the response status code should be 404
And the response status message should have the following text "Not Found"
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"
Scenario: Get paging of list inbox (Negative Test)
Given I request "cases/unassigned/pawdd?start=4&limit=10"
Then the response status code should be 404
And the response status message should have the following text "Not Found"
Scenario: Returns a list of the cases for the logged in user (Advanced Search)
Given I request "cases/advanced-search"
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: Get paging of list inbox (Negative Test)
Given I request "cases/paused/pawdd?start=4&limit=10"
Then the response status code should be 404
And the response status message should have the following text "Not Found"
Scenario: Get paging of list inbox (Negative Test)
Given I request "cases/advanced-search/pawdd?start=4&limit=10"
Then the response status code should be 404
And the response status message should have the following text "Not Found"

View File

@@ -9,7 +9,7 @@ Background:
Scenario: Returns a list of the uploaded documents for a given case
Given I request "cases/64654381053382b8bb4c415067063003/input-documents"
Given I request "cases/170220159534214f642abb8058832933/input-documents"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
@@ -17,14 +17,14 @@ Scenario: Returns a list of the uploaded documents for a given case
Scenario: Returns an uploaded documents for a given case
Given I request "cases/64654381053382b8bb4c415067063003/input-document/6075490825331a1c5eebff9015468244"
Given I request "cases/170220159534214f642abb8058832933/input-document/6075490825331a1c5eebff9015468244"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "object"
Scenario: Post metadata and then upload documents for a given case
Given POST upload an input document "/home/wendy/uploadfiles/test1.html" to "cases/64654381053382b8bb4c415067063003/input-document"
Given POST upload an input document "/home/wendy/uploadfiles/test1.html" to "cases/170220159534214f642abb8058832933/input-document"
"""
{
@@ -35,16 +35,16 @@ Scenario: Post metadata and then upload documents for a given case
}
"""
Then the response status code should be 201
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 "" in session array
And store "app_doc_uid" in session array
Scenario: Delete an uploaded or generated document from a case.
Given that I want to delete a resource with the key "" stored in session array
And I request "cases/64654381053382b8bb4c415067063003/input-document/{app_doc_uid}"
Given that I want to delete a resource with the key "app_doc_uid" stored in session array
And I request "cases/170220159534214f642abb8058832933/input-document"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"

View File

@@ -9,7 +9,7 @@ Background:
Scenario: Returns a list of the uploaded documents for a given case
Given I request "cases/64654381053382b8bb4c415067063003/input-documents"
Given I request "cases/170220159534214f642abb8058832933/input-documents"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
@@ -34,10 +34,10 @@ Scenario Outline: Post metadata and then upload documents for a given case
Examples:
| app_doc_uid_number | document_file | case_uid | inp_doc_uid | tas_uid | app_doc_comment |
| 1 | /home/wendy/uploadfiles/test1.html | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 2 | /home/wendy/uploadfiles/random.jpg | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 3 | /home/wendy/uploadfiles/test.pm | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 4 | /home/wendy/uploadfiles/test.txt | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 1 | /home/wendy/uploadfiles/test1.html | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 2 | /home/wendy/uploadfiles/random.jpg | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 3 | /home/wendy/uploadfiles/test.pm | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 4 | /home/wendy/uploadfiles/test.txt | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
Scenario Outline: Returns an uploaded documents for a given case
Given I request "cases/<case_uid>/output-document/app_doc_uid" with the key "app_doc_uid" stored in session array as variable "app_doc_uid_<app_doc_uid_number>"
@@ -57,16 +57,16 @@ Scenario Outline: Returns an uploaded documents for a given case
Examples:
| test_description | app_doc_uid_number | case_uid | inp_doc_uid | tas_uid | app_doc_comment |
| Get Input "Desert.jpg" | 1 | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| Get Input "Screenshot Case Archive.docx" | 2 | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| Get Input "alert_message.html" | 3 | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| Get Input "actionsByEmail-2.5.0.28.tar" | 4 | 64654381053382b8bb4c415067063003 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| Get Input "Desert.jpg" | 1 | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| Get Input "Screenshot Case Archive.docx" | 2 | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| Get Input "alert_message.html" | 3 | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| Get Input "actionsByEmail-2.5.0.28.tar" | 4 | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
Scenario Outline: Delete an uploaded or generated document from a case.
Given that I want to delete a resource with the key "app_doc_uid_<app_doc_uid_number>" stored in session array
And I request "cases/64654381053382b8bb4c415067063003/input-document/"
Given that I want to delete a resource with the key "app_doc_uid" stored in session array as variable "app_doc_uid_<app_doc_uid_number>"
And I request "cases/170220159534214f642abb8058832933/input-document"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"

View File

@@ -0,0 +1,35 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Input Documents cases - negative
Requirements:
a workspace with one case of the process "Test Input Document Case"
and there are three Input Document in the process and the verify in one case
Background:
Given that I have a valid access_token
Scenario: Returns a list of the uploaded documents for a given case
Given I request "cases/170220159534214f642abb8058832000/input-documents"
Then the response status code should be 404
Scenario Outline: Post metadata and then upload documents for a given case
Given POST upload an input document "<document_file>" to "cases/<case_uid>/input-document"
"""
{
"inp_doc_uid": "<inp_doc_uid>",
"tas_uid": "<tas_uid>",
"app_doc_comment": "<app_doc_comment>"
}
"""
Then the response status code should be 400
Examples:
| app_doc_uid_number | document_file | case_uid | inp_doc_uid | tas_uid | app_doc_comment |
| 1 | /inexistent_test1.html | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
| 1 | /home/wendy/uploadfiles/test1.html | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | | comment 1 |
| 1 | /home/wendy/uploadfiles/test1.html | 170220159534214f642abb8058832933 | | 19582733053319e304cfa76025663570 | comment 1 |

View File

@@ -41,7 +41,7 @@ Feature: Output Documents Negative Tests
Examples:
| test_description | project | out_doc_title | out_doc_description |out_doc_filename | out_doc_template | out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_current_revision | out_doc_field_mapping | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | error_code | error_message |
| Invalid PDF Generator | 4224292655297723eb98691001100052 | Endpoint New Version 4 | Output Document new version - EndPoint | Output 5 | | @#$%¼¤¾½ | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | 400 | out_doc_report_generator |
| Invalid PDF Generator | 4224292655297723eb98691001100052 | Endpoint New Version 4 | Output Document new version - EndPoint | Output 5 | | @#$%¼¤¾½ | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | 400 | out_doc_report_generator |
| Invalid landscape | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURIT5 | Output Document new version PDF SECURITY | Output 6 | | TCPDF | 34 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | 400 | out_doc_landscape |
| Invalid media type | 4224292655297723eb98691001100052 | Endpoint New Version Doc6 | Output Document new version solo doc | Output 7 | | TCPDF | 0 | Legal!@#$$$%^&| 25 | 25 | 25 | 25 | WORD | HTML | 0 | | 1 | | | 0 | | | | 400 | out_doc_media |
| Invalid document type | 4224292655297723eb98691001100052 | Endpoint New Version PDF7 | Output Document new version solo pdf | Output 8 | | TCPDF | 0 | Legal | 25,56.98 | 25 | 25 | 25 | PDF | HTML | 0 | | 1 | | | 1 | sample | sample | print | 400 | out_doc_left_margin |

View File

@@ -384,6 +384,7 @@ class RestContext extends BehatContext
$putFields = is_object($this->_restObject)
? (array)$this->_restObject
: $this->_restObject;
$this->printDebug("URL F: $url\n");
$this->_request = $this->_client
->put($url, $this->_headers,
(empty($this->_requestBody) ? $putFields :
@@ -1504,4 +1505,53 @@ class RestContext extends BehatContext
}
/**
* @Given /^the "([^"]*)" property in object (\d+) of property "([^"]*)" equals "([^"]*)"$/
*/
public function thePropertyInObjectOfPropertyEquals($propertyName, $row, $propertyParent, $propertyValue)
{
$data = $this->_data;
if (empty($data)) {
throw new Exception("Response is empty or was not JSON\n\n"
. $this->_response->getBody(true));
return;
}
if (!isset($data->$propertyParent)) {
throw new Exception("Response has not the property '$propertyParent'\n\n"
. $this->_response->getBody(true));
return;
}
$data = $data->$propertyParent;
if (!empty($data)) {
if (!is_object($data)) {
throw new Exception("the $propertyParent in Response data is not an array!\n\n" );
}
if (is_object($data) && !isset($data->$row)) {
throw new Exception("the Response data is an array, but the row '$row' does not exists!\n\n" );
}
if (!isset($data->$row->$propertyName)) {
throw new Exception("Property '"
. $propertyName . "' is not set!\n\n"
);
}
if (is_array($data->$row->$propertyName)) {
throw new Exception("$propertyName is an array and we expected a value\n\n"
. $this->_response->getBody(true));
}
if ($data->$row->$propertyName != $propertyValue) {
throw new \Exception('Property value mismatch! (given: '
. $propertyValue . ', match: '
. $data->$row->$propertyName . ")\n\n"
);
}
} else {
throw new Exception("Response was not JSON\n\n"
. $this->_response->getBody(true));
}
}
}

View File

@@ -28,18 +28,19 @@ if (isset($_FILES["PROCESS_FILENAME"])) {
if ($ext == "pmx") {
$importer = new \ProcessMaker\Importer\XmlImporter();
$importer->setSourceFromGlobals("PROCESS_FILENAME");
$importer->setData("usr_uid", $_SESSION['USER_LOGGED']);
$importer->setSaveDir(PATH_DOCUMENT . 'input');
$importer->setSourceFromGlobals("PROCESS_FILENAME");
try {
$res = $importer->import();
$prjUid = $importer->import();
$result = array(
"success" => true,
"catchMessage" => "",
"ExistProcessInDatabase" => 0,
"ExistGroupsInDatabase" => 0,
"sNewProUid" => $res[0]["new_uid"],
"sNewProUid" => $prjUid,
"project_type" => "bpmn"
);
} catch (Exception $e) {
@@ -58,8 +59,25 @@ if (isset($_FILES["PROCESS_FILENAME"])) {
echo json_encode($result);
exit(0);
}
}
} elseif (isset($_POST["PRO_FILENAME"]) && file_exists(PATH_DOCUMENT . 'input' . PATH_SEP . $_POST["PRO_FILENAME"])) {
switch ($_POST["IMPORT_OPTION"]) {
case 1: $option = ProcessMaker\Importer\XmlImporter::IMPORT_OPTION_OVERWRITE; break;
case 2: $option = ProcessMaker\Importer\XmlImporter::IMPORT_OPTION_DISABLE_AND_CREATE_NEW; break;
case 3: $option = ProcessMaker\Importer\XmlImporter::IMPORT_OPTION_CREATE_NEW; break;
}
$importer = new ProcessMaker\Importer\XmlImporter();
$importer->setData("usr_uid", $_SESSION['USER_LOGGED']);
$importer->setSourceFile(PATH_DOCUMENT . 'input' . PATH_SEP . $_POST["PRO_FILENAME"]);
try {
$res = $importer->import($option);
} catch (\Exception $e) {
die($e->getMessage());
}
}
die;
function reservedWordsSqlValidate ($data)
{
$arrayAux = array ();

View File

@@ -0,0 +1,521 @@
<?php
namespace BusinessModel;
use \G;
use \UsersPeer;
use \CasesPeer;
/**
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
class Cases
{
/**
* Get list for Cases
*
* @access public
* @param array $dataList, Data for list
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function getList($dataList = array())
{
Validator::isArray($dataList, '$dataList');
if (!isset($dataList["userId"])) {
throw (new \Exception("The user with userId: '' does not exist."));
} else {
Validator::usrUid($dataList["userId"], "userId");
}
G::LoadClass("applications");
$solrEnabled = false;
$userUid = $dataList["userId"];
$callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001";
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APP_CACHE_VIEW.APP_NUMBER";
$start = isset( $dataList["start"] ) ? $dataList["start"] : "0";
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "25";
$filter = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
$process = isset( $dataList["process"] ) ? $dataList["process"] : "";
$category = isset( $dataList["category"] ) ? $dataList["category"] : "";
$status = isset( $dataList["status"] ) ? strtoupper( $dataList["status"] ) : "";
$user = isset( $dataList["user"] ) ? $dataList["user"] : "";
$search = isset( $dataList["search"] ) ? $dataList["search"] : "";
$action = isset( $dataList["action"] ) ? $dataList["action"] : "todo";
$type = "extjs";
$dateFrom = isset( $dataList["dateFrom"] ) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
$dateTo = isset( $dataList["dateTo"] ) ? substr( $dataList["dateTo"], 0, 10 ) : "";
$first = isset( $dataList["first"] ) ? true :false;
$valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search');
if (!in_array($action, $valuesCorrect)) {
throw (new \Exception('The value for $action is incorrect.'));
}
if ($action == 'search' || $action == 'to_reassign') {
$userUid = ($user == "CURRENT_USER") ? $userUid : $user;
if ($first) {
$result = array();
$result['totalCount'] = 0;
$result['data'] = array();
return $result;
}
}
if ((
$action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" ||
$action == "selfservice" || $action == "unassigned" || $action == "search"
) &&
(($solrConf = \System::solrEnv()) !== false)
) {
G::LoadClass("AppSolr");
$ApplicationSolrIndex = new \AppSolr(
$solrConf["solr_enabled"],
$solrConf["solr_host"],
$solrConf["solr_instance"]
);
if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
//Check if there are missing records to reindex and reindex them
$ApplicationSolrIndex->synchronizePendingApplications();
$solrEnabled = true;
}
}
if ($solrEnabled) {
$result = $ApplicationSolrIndex->getAppGridData(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
$sort,
$category
);
} else {
G::LoadClass("applications");
$apps = new \Applications();
$result = $apps->getAll(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
(strpos($sort, ".") !== false)? $sort : "APP_CACHE_VIEW." . $sort,
$category
);
}
if (!empty($result['data'])) {
foreach ($result['data'] as &$value) {
$value = array_change_key_case($value, CASE_LOWER);
}
}
return $result;
}
/**
* Get data of a Case
*
* @param string $caseUid Unique id of Case
* @param string $userUid Unique id of User
*
* return array Return an array with data of Case Info
*/
public function getCaseInfo($caseUid, $userUid)
{
try {
$solrEnabled = 0;
if (($solrEnv = \System::solrEnv()) !== false) {
\G::LoadClass("AppSolr");
$appSolr = new \AppSolr(
$solrEnv["solr_enabled"],
$solrEnv["solr_host"],
$solrEnv["solr_instance"]
);
if ($appSolr->isSolrEnabled() && $solrEnv["solr_enabled"] == true) {
//Check if there are missing records to reindex and reindex them
$appSolr->synchronizePendingApplications();
$solrEnabled = 1;
}
}
if ($solrEnabled == 1) {
try {
\G::LoadClass("searchIndex");
$arrayData = array();
$delegationIndexes = array();
$columsToInclude = array("APP_UID");
$solrSearchText = null;
//Todo
$solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:TO_DO AND APP_ASSIGNED_USERS:" . $userUid . ")";
$delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . $userUid . "_txt";
//Draft
$solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:DRAFT AND APP_DRAFT_USER:" . $userUid . ")";
//Index is allways 1
$solrSearchText = "($solrSearchText)";
//Add del_index dynamic fields to list of resulting columns
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
$solrRequestData = \Entity_SolrRequestData::createForRequestPagination(
array(
"workspace" => $solrEnv["solr_instance"],
"startAfter" => 0,
"pageSize" => 1000,
"searchText" => $solrSearchText,
"numSortingCols" => 1,
"sortCols" => array("APP_NUMBER"),
"sortDir" => array(strtolower("DESC")),
"includeCols" => $columsToIncludeFinal,
"resultFormat" => "json"
)
);
//Use search index to return list of cases
$searchIndex = new \BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
//Execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
//Get the missing data from database
$arrayApplicationUid = array();
foreach ($solrQueryResult->aaData as $i => $data) {
$arrayApplicationUid[] = $data["APP_UID"];
}
$aaappsDBData = $appSolr->getListApplicationDelegationData($arrayApplicationUid);
foreach ($solrQueryResult->aaData as $i => $data) {
//Initialize array
$delIndexes = array(); //Store all the delegation indexes
//Complete empty values
$applicationUid = $data["APP_UID"]; //APP_UID
//Get all the indexes returned by Solr as columns
for($i = count($columsToInclude); $i <= count($data) - 1; $i++) {
if (is_array($data[$columsToIncludeFinal[$i]])) {
foreach ($data[$columsToIncludeFinal[$i]] as $delIndex) {
$delIndexes[] = $delIndex;
}
}
}
//Verify if the delindex is an array
//if is not check different types of repositories
//the delegation index must always be defined.
if (count($delIndexes) == 0) {
$delIndexes[] = 1; // the first default index
}
//Remove duplicated
$delIndexes = array_unique($delIndexes);
//Get records
foreach ($delIndexes as $delIndex) {
$aRow = array();
//Copy result values to new row from Solr server
$aRow["APP_UID"] = $data["APP_UID"];
//Get delegation data from DB
//Filter data from db
$indexes = $appSolr->aaSearchRecords($aaappsDBData, array(
"APP_UID" => $applicationUid,
"DEL_INDEX" => $delIndex
));
foreach ($indexes as $index) {
$row = $aaappsDBData[$index];
}
if(!isset($row))
{
continue;
}
$aRow["APP_NUMBER"] = $row["APP_NUMBER"];
$aRow["APP_STATUS"] = $row["APP_STATUS"];
$aRow["PRO_UID"] = $row["PRO_UID"];
$aRow["DEL_INDEX"] = $row["DEL_INDEX"];
$arrayData[] = array(
"guid" => $aRow["APP_UID"],
"name" => $aRow["APP_NUMBER"],
"status" => $aRow["APP_STATUS"],
"delIndex" => $aRow["DEL_INDEX"],
"processId" => $aRow["PRO_UID"]
);
}
}
$case = array();
for ($i = 0; $i<=count($arrayData)-1; $i++) {
if ($arrayData[$i]["guid"] == $caseUid) {
$case = $arrayData[$i];
}
}
return $case;
} catch (\InvalidIndexSearchTextException $e) {
$arrayData = array();
$arrayData[] = array (
"guid" => $e->getMessage(),
"name" => $e->getMessage(),
"status" => $e->getMessage(),
"delIndex" => $e->getMessage(),
"processId" => $e->getMessage()
);
return $arrayData;
}
} else {
$arrayData = array();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\AppCacheViewPeer::APP_UID);
$criteria->addSelectColumn(\AppCacheViewPeer::DEL_INDEX);
$criteria->addSelectColumn(\AppCacheViewPeer::APP_NUMBER);
$criteria->addSelectColumn(\AppCacheViewPeer::APP_STATUS);
$criteria->addSelectColumn(\AppCacheViewPeer::PRO_UID);
$criteria->add(\AppCacheViewPeer::USR_UID, $userUid);
$criteria->add(\AppCacheViewPeer::APP_UID, $caseUid);
$criteria->add(
//ToDo - getToDo()
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "TO_DO", \CRITERIA::EQUAL)->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
)->addOr(
//Draft - getDraft()
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "DRAFT", \CRITERIA::EQUAL)->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
);
$criteria->addDescendingOrderByColumn(\AppCacheViewPeer::APP_NUMBER);
$rsCriteria = \AppCacheViewPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayData[] = array(
"guid" => $row["APP_UID"],
"name" => $row["APP_NUMBER"],
"status" => $row["APP_STATUS"],
"delIndex" => $row["DEL_INDEX"],
"processId" => $row["PRO_UID"]
);
}
return $arrayData;
}
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data Task Case
*
* @param string $caseUid Unique id of Case
*
* return array Return an array with Task Case
*/
public function getTaskCase($caseUid)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
$fields = $ws->taskCase($caseUid);
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Add New Case
*
* @param string $prjUid Unique id of Project
* @param string $actUid Unique id of Activity
* @param string $caseUid Unique id of Case
* @param array $variables
*
* return array Return an array with Task Case
*/
public function addCase($prjUid, $actUid, $userUid, $variables)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
if ($variables) {
$variables = array_shift($variables);
}
$fields = $ws->newCase($prjUid, $userUid, $actUid, $variables);
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Add New Case Impersonate
*
* @param string $prjUid Unique id of Project
* @param string $usrUid Unique id of User
* @param string $caseUid Unique id of Case
* @param array $variables
*
* return array Return an array with Task Case
*/
public function addCaseImpersonate($prjUid, $usrUid, $caseUid, $variables)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
$fields = $ws->newCaseImpersonate($prjUid, $usrUid, $variables, '1352844695225ff5fe54de2005407079');
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Reassign Case
*
* @param string $caseUid Unique id of Case
* @param string $userUid Unique id of User
* @param string $delIndex
* @param string $userUidSource Unique id of User Source
* @param string $userUid $userUidTarget id of User Target
*
* return array Return an array with Task Case
*/
public function updateReassignCase($caseUid, $userUid, $delIndex, $userUidSource, $userUidTarget)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
$fields = $ws->reassignCase($userUid, $caseUid, $delIndex, $userUidSource, $userUidTarget);
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Put cancel case
*
* @access public
* @param string $app_uid, Uid for case
* @param string $usr_uid, Uid for user
* @param string $del_index, Index for case
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function putCancelCase($app_uid, $usr_uid, $del_index = false) {
Validator::appUid($app_uid, '$cas_uid');
Validator::usrUid($usr_uid, '$usr_uid');
if ($del_index === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid);
}
$case = new \Cases();
$case->cancelCase( $app_uid, $del_index, $usr_uid );
}
/**
* Put pause case
*
* @access public
* @param string $app_uid , Uid for case
* @param string $usr_uid , Uid for user
* @param bool|string $del_index , Index for case
* @param null|string $unpaused_date, Date for unpaused
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function putPauseCase($app_uid, $usr_uid, $del_index = false, $unpaused_date = null) {
Validator::appUid($app_uid, '$cas_uid');
Validator::usrUid($usr_uid, '$usr_uid');
if ($unpaused_date != null) {
Validator::isDate($unpaused_date, 'Y-m-d', '$unpaused_date');
}
if ($del_index === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid);
}
$case = new \Cases();
$case->pauseCase( $app_uid, $del_index, $usr_uid, $unpaused_date );
}
/**
* Put unpause case
*
* @access public
* @param string $app_uid , Uid for case
* @param string $usr_uid , Uid for user
* @param bool|string $del_index , Index for case
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function putUnpauseCase($app_uid, $usr_uid, $del_index = false) {
Validator::appUid($app_uid, '$cas_uid');
Validator::usrUid($usr_uid, '$usr_uid');
if ($del_index === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid);
}
$case = new \Cases();
$case->unpauseCase( $app_uid, $del_index, $usr_uid );
}
/**
* Put unpause case
*
* @access public
* @param string $app_uid , Uid for case
* @param string $usr_uid , Uid for user
* @param bool|string $del_index , Index for case
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function putExecuteTriggerCase($app_uid, $tri_uid, $usr_uid, $del_index = false) {
Validator::appUid($app_uid, '$cas_uid');
Validator::triUid($tri_uid, '$tri_uid');
Validator::usrUid($usr_uid, '$usr_uid');
if ($del_index === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid);
}
$case = new \wsBase();
$case->executeTrigger( $usr_uid, $app_uid, $tri_uid, $del_index );
}
/**
* Delete case
*
* @access public
* @param string $app_uid, Uid for case
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function deleteCase($app_uid) {
Validator::appUid($app_uid, '$cas_uid');
$case = new \Cases();
$case->removeCase( $app_uid );
}
}

View File

@@ -608,14 +608,18 @@ class Cases
}
\G::LoadClass('wsBase');
$ws = new \wsBase();
$fields = $ws->reassignCase($userUid, $applicationUid, $delIndex, $userUidSource, $userUidTarget);
$fields = $ws->reassignCase($userUid, $applicationUid, $delIndex, $userUidTarget, $userUidSource);
$array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) {
throw (new \Exception($array ["message"]));
if (array_key_exists("status_code", $array)) {
if ($array ["status_code"] != 0) {
throw (new \Exception($array ["message"]));
} else {
unset($array['status_code']);
unset($array['message']);
unset($array['timestamp']);
}
} else {
unset($array['status_code']);
unset($array['message']);
unset($array['timestamp']);
throw (new \Exception('The Application with app_uid: '.$applicationUid.' doesn\'t exist'));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -58,6 +58,10 @@ class InputDocument
public function getCasesInputDocument($applicationUid, $userUid, $inputDocumentUid)
{
try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This input document with id: '.$inputDocumentUid.' doesn\'t exist!'));
}
$sApplicationUID = $applicationUid;
$sUserUID = $userUid;
\G::LoadClass('case');
@@ -214,6 +218,7 @@ class InputDocument
$arrayData["DEL_INDEX"] = $delIndex;
$arrayData["TAS_UID"] = $taskUid;
$case->updateCase($applicationUid, $arrayData);
return($this->getCasesInputDocument($applicationUid, $userUid, $appDocUid));
} catch (\Exception $e) {
throw $e;
}

View File

@@ -31,6 +31,142 @@ class Department
return $aDepts;
}
/**
* Get list for Assigned User
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*/
public function getAssignedUser($dep_uid)
{
$dep_uid = Validator::depUid($dep_uid);
$oDept = new \Department();
$oDept->Load( $dep_uid );
$manager = $oDept->getDepManager();
$oCriteria = new \Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL );
$oCriteria->add( UsersPeer::DEP_UID, $dep_uid );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$dataTemp = $oDataset->getRow();
$aUsers[] = array_change_key_case($dataTemp, CASE_LOWER);
$index = sizeof( $aUsers ) - 1;
$aUsers[$index]['usr_supervisor'] = ($manager == $aUsers[$index]['usr_uid']) ? true : false;
}
return $aUsers;
}
/**
* Get list for Available User
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*/
public function getAvailableUser($dep_uid)
{
$dep_uid = Validator::depUid($dep_uid);
$oCriteria = new \Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$dataTemp = $oDataset->getRow();
$aUsers[] = array_change_key_case($dataTemp, CASE_LOWER);
}
return $aUsers;
}
/**
* Put Assign User
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return void
*/
public function assignUser($dep_uid, $usr_uid)
{
$dep_uid = Validator::depUid($dep_uid);
$usr_uid = Validator::usrUid($usr_uid);
$dep = new \Department();
$dep->load($dep_uid);
$dep_manager = $dep->getDepManager();
$manager = ($dep_manager == '') ? true : false;
$dep->addUserToDepartment( $dep_uid, $usr_uid, $manager, false );
$dep->updateDepartmentManager( $dep_uid );
}
/**
* Post Unassign User
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return void
*/
public function unassignUser($dep_uid, $usr_uid)
{
$dep_uid = Validator::depUid($dep_uid);
$usr_uid = Validator::usrUid($usr_uid);
$dep = new \Department();
$dep->load( $dep_uid );
$manager = $dep->getDepManager();
$dep->removeUserFromDepartment( $dep_uid, $usr_uid );
if ($usr_uid == $manager) {
$editDepto['DEP_UID'] = $dep_uid;
$editDepto['DEP_MANAGER'] = '';
$dep->update( $editDepto );
$dep->updateDepartmentManager($dep_uid);
}
}
/**
* Put Set Manager User
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return void
*/
public function setManagerUser($dep_uid, $usr_uid)
{
$dep_uid = Validator::depUid($dep_uid);
$usr_uid = Validator::usrUid($usr_uid);
$editDepartment['DEP_UID'] = $dep_uid;
$editDepartment['DEP_MANAGER'] = $usr_uid;
$oDept = new \Department();
$oDept->update( $editDepartment );
$oDept->updateDepartmentManager( $dep_uid );
}
/**
* Get list for Departments
* @var string $dep_uid. Uid for Department
@@ -149,11 +285,15 @@ class Department
public function deleteDepartment($dep_uid)
{
$dep_uid = Validator::depUid($dep_uid);
$oDepartment = new \Department();
$countUsers = $oDepartment->cantUsersInDepartment($dep_uid);
if ($countUsers != 0) {
throw (new \Exception("Department cannot be deleted while has assigned users."));
}
$dep_data = $this->getDepartment($dep_uid);
if ($dep_data['has_children'] != 0) {
throw (new \Exception("Can not delete the department, it has a children department."));
}
$oDepartment = new \Department();
$oDepartment->remove($dep_uid);
}

View File

@@ -58,6 +58,11 @@ abstract class Exporter
return $this->projectData["PRJ_NAME"];
}
public function getProjectUid()
{
return $this->projectData["PRJ_UID"];
}
/**
* Builds Project Data Structure
*
@@ -68,7 +73,8 @@ abstract class Exporter
$data = array();
$data["metadata"] = $this->getMetadata();
$data["metadata"]["project_name"] = $this->getProjectName();
$data["metadata"]["name"] = $this->getProjectName();
$data["metadata"]["uid"] = $this->getProjectUid();
$bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($this->prjUid);
$bpmnStruct["BOUND"] = \BpmnBound::getAll($this->prjUid);
@@ -175,7 +181,7 @@ abstract class Exporter
"export_server_addr" => isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"].":".$_SERVER["SERVER_PORT"] : "Unknown",
"export_server_os" => PHP_OS ,
"export_server_php_version" => PHP_VERSION_ID,
"project_workspace" => defined("SYS_SYS") ? SYS_SYS : "Unknown",
"workspace" => defined("SYS_SYS") ? SYS_SYS : "Unknown",
);
}
}

View File

@@ -10,10 +10,11 @@ abstract class Importer
protected $importData = array();
protected $filename = "";
protected $saveDir = "";
protected $metadata = array();
const IMPORT_OPTION_OVERWRITE = "OVERWRITE_PROJECT";
const IMPORT_OPTION_DISABLE_AND_CREATE_NEW = "DISABLE_AND_CREATE_NEW_PROJECT";
const IMPORT_OPTION_CREATE_NEW = "CREATE_NEW_PROJECT";
const IMPORT_OPTION_OVERWRITE = "project.import.override";
const IMPORT_OPTION_DISABLE_AND_CREATE_NEW = "project.import.disable_and_create_new";
const IMPORT_OPTION_CREATE_NEW = "project.import.create_new";
/**
* Success, Project imported successfully.
@@ -36,11 +37,27 @@ abstract class Importer
switch ($option) {
case self::IMPORT_OPTION_CREATE_NEW:
$result = $this->doImport();
if ($this->targetExists()) {
throw new \Exception(sprintf(
"Project already exists, you need set an action to continue. " .
"Available actions: [%s|%s|%s].", self::IMPORT_OPTION_CREATE_NEW,
self::IMPORT_OPTION_OVERWRITE, self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW
), self::IMPORT_STAT_TARGET_ALREADY_EXISTS);
}
$generateUid = false;
$result = $this->doImport($generateUid);
break;
case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
$this->disableProject();
// this option should generate new uid for all objects
$generateUid = true;
$result = $this->doImport($generateUid);
break;
case self::IMPORT_OPTION_OVERWRITE:
// this option shouldn't generate new uid for all objects
$generateUid = false;
$this->removeProject();
$result = $this->doImport($generateUid);
break;
}
@@ -64,14 +81,6 @@ abstract class Importer
$this->importData = $this->load();
$this->validateImportData();
if ($this->targetExists()) {
throw new \Exception(sprintf(
"Project already exists, you need set an action to continue. " .
"Avaliable actions: [%s|%s|%s].", self::IMPORT_OPTION_CREATE_NEW,
self::IMPORT_OPTION_OVERWRITE, self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW
), self::IMPORT_STAT_TARGET_ALREADY_EXISTS);
}
}
public function setData($key, $value)
@@ -118,9 +127,17 @@ abstract class Importer
}
public function disableCurrentProject()
public function disableProject()
{
$project = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($this->metadata["uid"]);
$project->setDisabled();
}
public function removeProject()
{
$project = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($this->metadata["uid"]);
$force = true;
$project->remove($force);
}
/**
@@ -179,7 +196,7 @@ abstract class Importer
umask($oldUmask);
}
protected function importBpmnTables(array $tables)
protected function importBpmnTables(array $tables, $generateUid = false)
{
// Build BPMN project struct
$project = $tables["project"][0];
@@ -195,7 +212,7 @@ abstract class Importer
$project["prj_author"] = isset($this->data["usr_uid"])? $this->data["usr_uid"]: "00000000000000000000000000000001";
$project["process"] = $tables["process"][0];
return Adapter\BpmnWorkflow::createFromStruct($project);
return Adapter\BpmnWorkflow::createFromStruct($project, $generateUid);
}
protected function importWfTables(array $tables)
@@ -239,15 +256,19 @@ abstract class Importer
}
}
public function doImport()
public function doImport($generateUid = true)
{
$tables = $this->importData["tables"];
$files = $this->importData["files"];
$result = $this->importBpmnTables($tables["bpmn"]);
$result = $this->importBpmnTables($tables["bpmn"], $generateUid);
$this->importWfTables($tables["workflow"]);
$this->importWfFiles($files["workflow"]);
return $result;
if ($generateUid) {
return $result[0]["new_uid"];
} else {
return $result;
}
}
}

View File

@@ -9,7 +9,6 @@ class XmlImporter extends Importer
protected $dom;
protected $root;
protected $version = "";
protected $metadata;
public function __construct()
{
@@ -44,7 +43,16 @@ class XmlImporter extends Importer
throw new \Exception("Invalid Document format, metadata section is missing or has multiple definition.");
}
$this->metadata = $metadataNode->item(0);
$metadataNodeList = $metadataNode->item(0)->getElementsByTagName("meta");
if ($metadataNodeList->length == 0) {
throw new \Exception("Invalid Document format, metadata information is corrupt.");
}
foreach ($metadataNodeList as $metadataNode) {
$this->metadata[$metadataNode->getAttribute("key")] = $this->getTextNode($metadataNode);
}
// load project definition
/** @var \DOMElement[]|\DomNodeList $definitions */

View File

@@ -413,42 +413,53 @@ class BpmnWorkflow extends Project\Bpmn
$this->wp->remove();
}
public static function createFromStruct(array $projectData)
public static function createFromStruct(array $projectData, $generateUid = true)
{
$bwp = new self;
$result = array();
$data = array();
// if (array_key_exists("prj_uid", $projectData)) {
// $result[0]["old_uid"] = $projectData["prj_uid"];
// } else {
// $result[0]["old_uid"] = "";
// }
if ($generateUid) {
$result[0]["old_uid"] = isset($projectData["prj_uid"]) ? $projectData["prj_uid"] : "";
$projectData["prj_uid"] = Util\Common::generateUID();
$result[0]["new_uid"] = $projectData["prj_uid"];
$result[0]["object"] = "project";
}
//$projectData["prj_uid"] = Util\Common::generateUID();
$result[0]["new_uid"] = $projectData["prj_uid"];
$result[0]["old_uid"] = "";
$result[0]["object"] = "project";
$data["PRJ_UID"] = $projectData["prj_uid"];
$data["PRJ_AUTHOR"] = $projectData["prj_author"];
$bwp->create(array(
"PRJ_UID" => $projectData["prj_uid"],
"PRJ_AUTHOR" => $projectData["prj_author"]
));
$bwp->create($data);
$diagramData = $processData = array();
if (array_key_exists("diagrams", $projectData) && is_array($projectData["diagrams"]) && count($projectData["diagrams"]) > 0) {
$diagramData = array_change_key_case($projectData["diagrams"][0], CASE_UPPER);
}
if (array_key_exists("process", $projectData) && is_array($projectData["process"])) {
$processData = array_change_key_case($projectData["process"], CASE_UPPER);
if ($generateUid) {
$result[1]["old_uid"] = $diagramData["DIA_UID"];
$diagramData["DIA_UID"] = Util\Common::generateUID();
$result[1]["new_uid"] = $diagramData["DIA_UID"];
$result[1]["object"] = "diagram";
}
}
$bwp->addDiagram($diagramData);
if (array_key_exists("process", $projectData) && is_array($projectData["process"])) {
$processData = array_change_key_case($projectData["process"], CASE_UPPER);
if ($generateUid) {
$result[2]["old_uid"] = $processData["PRO_UID"];
$processData["PRO_UID"] = Util\Common::generateUID();
$result[2]["new_uid"] = $processData["PRO_UID"];
$result[2]["object"] = "process";
}
}
$bwp->addProcess($processData);
$result = array_merge($result, self::updateFromStruct($bwp->prjUid, $projectData));
$mappedUid = array_merge($result, self::updateFromStruct($bwp->prjUid, $projectData, $generateUid));
return $result;
return $generateUid ? $mappedUid : $bwp->getUid();
}
/**
@@ -545,7 +556,7 @@ class BpmnWorkflow extends Project\Bpmn
* @param $projectData
* @return array
*/
public static function updateFromStruct($prjUid, $projectData)
public static function updateFromStruct($prjUid, $projectData, $generateUid = true)
{
$diagram = isset($projectData["diagrams"]) && isset($projectData["diagrams"][0]) ? $projectData["diagrams"][0] : array();
$result = array();
@@ -564,10 +575,12 @@ class BpmnWorkflow extends Project\Bpmn
$activity = $bwp->getActivity($activityData["ACT_UID"]);
if (is_null($activity)) {
$oldActUid = $activityData["ACT_UID"];
$activityData["ACT_UID"] = Util\Common::generateUID();
if ($generateUid) {
$oldActUid = $activityData["ACT_UID"];
$activityData["ACT_UID"] = Util\Common::generateUID();
$result[] = array("object" => "activity", "new_uid" => $activityData["ACT_UID"], "old_uid" => $oldActUid);
}
$bwp->addActivity($activityData);
$result[] = array("object" => "activity", "new_uid" => $activityData["ACT_UID"], "old_uid" => $oldActUid);
} elseif (! $bwp->isEquals($activity, $activityData)) {
$bwp->updateActivity($activityData["ACT_UID"], $activityData);
} else {
@@ -592,17 +605,19 @@ class BpmnWorkflow extends Project\Bpmn
* Diagram's Gateways Handling
*/
$whiteList = array();
//print_r($diagram);
foreach ($diagram["gateways"] as $i => $gatewayData) {
$gatewayData = array_change_key_case($gatewayData, CASE_UPPER);
unset($gatewayData["_EXTENDED"]);
$gateway = $bwp->getGateway($gatewayData["GAT_UID"]);
if (is_null($gateway)) {
$oldActUid = $gatewayData["GAT_UID"];
$gatewayData["GAT_UID"] = Util\Common::generateUID();
if ($generateUid) {
$oldActUid = $gatewayData["GAT_UID"];
$gatewayData["GAT_UID"] = Util\Common::generateUID();
$result[] = array("object" => "gateway", "new_uid" => $gatewayData["GAT_UID"], "old_uid" => $oldActUid);
}
$bwp->addGateway($gatewayData);
$result[] = array("object" => "gateway", "new_uid" => $gatewayData["GAT_UID"], "old_uid" => $oldActUid);
} elseif (! $bwp->isEquals($gateway, $gatewayData)) {
$bwp->updateGateway($gatewayData["GAT_UID"], $gatewayData);
} else {
@@ -638,10 +653,13 @@ class BpmnWorkflow extends Project\Bpmn
$event = $bwp->getEvent($eventData["EVN_UID"]);
if (is_null($event)) {
$oldActUid = $eventData["EVN_UID"];
$eventData["EVN_UID"] = Util\Common::generateUID();
if ($generateUid) {
$oldActUid = $eventData["EVN_UID"];
$eventData["EVN_UID"] = Util\Common::generateUID();
$result[] = array("object" => "event", "new_uid" => $eventData["EVN_UID"], "old_uid" => $oldActUid);
}
$bwp->addEvent($eventData);
$result[] = array("object" => "event", "new_uid" => $eventData["EVN_UID"], "old_uid" => $oldActUid);
} elseif (! $bwp->isEquals($event, $eventData)) {
$bwp->updateEvent($eventData["EVN_UID"], $eventData);
} else {
@@ -672,9 +690,10 @@ class BpmnWorkflow extends Project\Bpmn
$flowData = array_change_key_case($flowData, CASE_UPPER);
// if it is a new flow record
if (! \BpmnFlow::exists($flowData["FLO_UID"])) {
if ($generateUid && ! \BpmnFlow::exists($flowData["FLO_UID"])) {
$oldFloUid = $flowData["FLO_UID"];
$flowData["FLO_UID"] = Util\Common::generateUID();
$result[] = array("object" => "flow", "new_uid" => $flowData["FLO_UID"], "old_uid" => $oldFloUid);
$mappedUid = self::mapUid($flowData["FLO_ELEMENT_ORIGIN"], $result);
if ($mappedUid !== false) {
@@ -685,8 +704,6 @@ class BpmnWorkflow extends Project\Bpmn
if ($mappedUid !== false) {
$flowData["FLO_ELEMENT_DEST"] = $mappedUid;
}
$result[] = array("object" => "flow", "new_uid" => $flowData["FLO_UID"], "old_uid" => $oldFloUid);
}
$diagram["flows"][$i] = $flowData;
@@ -728,4 +745,10 @@ class BpmnWorkflow extends Project\Bpmn
return false;
}
public function setDisabled($value = true)
{
parent::setDisabled($value);
$this->wp->setDisabled($value);
}
}

View File

@@ -125,16 +125,22 @@ class Bpmn extends Handler
$this->project->setPrjUpdateDate(date("Y-m-d H:i:s"));
$this->project->save();
$this->updateDiagram(array("DIA_NAME" => $data["PRJ_NAME"]));
if (isset($data["PRJ_NAME"])) {
$this->updateDiagram(array("DIA_NAME" => $data["PRJ_NAME"]));
}
}
public function remove()
public function remove($force = false)
{
/*
* 1. Remove Diagram related objects
* 2. Remove Project related objects
*/
if (! $force && ! $this->canRemove()) {
throw new \Exception("Project with prj_uid: {$this->getUid()} can not be deleted, it has started cases.");
}
self::log("Remove Project With Uid: {$this->prjUid}");
foreach ($this->getActivities() as $activity) {
$this->removeActivity($activity["ACT_UID"]);
@@ -201,6 +207,13 @@ class Bpmn extends Handler
return $retType == "array" ? $this->project->toArray() : $this->project;
}
public function canRemove()
{
// TODO this must validate if the project can be deleted or not.
// TODO the project can be deleted only if it has not any started cases
return true;
}
/*
* Projects elements handlers
*/
@@ -730,4 +743,10 @@ class Bpmn extends Handler
//self::log("checksum saved data: ", self::getChecksum($data), "checksum new data: ", self::getChecksum($newData));
return (self::getChecksum($data) !== self::getChecksum($newData));
}
public function setDisabled($value = true)
{
$status = $value ? "DISABLED" : "ACTIVE";
$this->update(array("PRJ_STATUS" => $status));
}
}

View File

@@ -98,6 +98,7 @@ class Workflow extends Handler
public function update($data)
{
$process = new Process();
$data["PRO_UID"] = $this->getUid();
$process->update($data);
}
@@ -765,4 +766,9 @@ class Workflow extends Handler
}
}
public function setDisabled($value = true)
{
$status = $value ? "DISABLED" : "ACTIVE";
$this->update(array("PRO_STATUS" => $status));
}
}

View File

@@ -35,6 +35,119 @@ class Department extends Api
}
}
/**
* @param string $dep_uid {@min 1}{@max 32}
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url GET /:dep_uid/assigned-user
*/
public function doGetAssignedUser($dep_uid)
{
try {
$oDepartment = new \ProcessMaker\BusinessModel\Department();
$response = $oDepartment->getAssignedUser($dep_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $dep_uid {@min 1}{@max 32}
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url GET /:dep_uid/available-user
*/
public function doGetAvailableUser($dep_uid)
{
try {
$oDepartment = new \ProcessMaker\BusinessModel\Department();
$response = $oDepartment->getAvailableUser($dep_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $dep_uid {@min 1}{@max 32}
* @param string $usr_uid {@min 1}{@max 32}
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url PUT /:dep_uid/assign-user/:usr_uid
*/
public function doPutAssignUser($dep_uid, $usr_uid)
{
try {
$oDepartment = new \ProcessMaker\BusinessModel\Department();
$response = $oDepartment->assignUser($dep_uid, $usr_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $dep_uid {@min 1}{@max 32}
* @param string $usr_uid {@min 1}{@max 32}
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url PUT /:dep_uid/unassign-user/:usr_uid
*/
public function doPutUnassignUser($dep_uid, $usr_uid)
{
try {
$oDepartment = new \ProcessMaker\BusinessModel\Department();
$response = $oDepartment->unassignUser($dep_uid, $usr_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $dep_uid {@min 1}{@max 32}
* @param string $usr_uid {@min 1}{@max 32}
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url PUT /:dep_uid/set-manager/:usr_uid
*/
public function doPutSetManager($dep_uid, $usr_uid)
{
try {
$oDepartment = new \ProcessMaker\BusinessModel\Department();
$response = $oDepartment->setManagerUser($dep_uid, $usr_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $dep_uid {@min 1}{@max 32}
*

View File

@@ -28,14 +28,14 @@ class CasesTest extends \PHPUnit_Framework_TestCase
*/
public function setUp()
{
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
$this->oCases = new \BusinessModel\Cases();
return true;
}
/**
* Test error for type in first field the function
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage Invalid value for '$dataList' it must be an array.
*
@@ -50,7 +50,7 @@ class CasesTest extends \PHPUnit_Framework_TestCase
/**
* Test error for empty userId in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The user with userId: '' does not exist.
*
@@ -65,150 +65,37 @@ class CasesTest extends \PHPUnit_Framework_TestCase
/**
* Test error for not exists userId in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The user with userId: 'IdDoesNotExists' does not exist.
* @expectedExceptionMessage The user with userId: 'UidInexistente' does not exist.
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesErrorNotExistsUserIdArray()
{
$this->oCases->getList(array('userId' => 'IdDoesNotExists'));
$this->oCases->getList(array('userId' => 'UidInexistente'));
}
/**
* Test error for incorrect value $action in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The value for $action is incorrect.
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesErrorIncorrectValueActionArray()
public function testGetListCasesErrorIncorrectValueArray()
{
$this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'incorrect'));
}
/**
* Test error for incorrect value $process in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The process with $pro_uid: 'IdDoesNotExists' does not exist.
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesErrorIncorrectValueProUidArray()
{
$this->oCases->getList(array(
'userId' => '00000000000000000000000000000001',
'process' => 'IdDoesNotExists'
));
}
/**
* Test error for incorrect value $process in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The category with $cat_uid: 'IdDoesNotExists' does not exist.
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesErrorIncorrectValueCatUidArray()
{
$this->oCases->getList(array(
'userId' => '00000000000000000000000000000001',
'category' => 'IdDoesNotExists'
));
}
/**
* Test error for incorrect value $process in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The user with $usr_uid: 'IdDoesNotExists' does not exist.
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesErrorIncorrectValueUserArray()
{
$this->oCases->getList(array(
'userId' => '00000000000000000000000000000001',
'user' => 'IdDoesNotExists'
));
}
/**
* Test error for incorrect value $process in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The value '2014-44-44' is not a valid date for the format 'Y-m-d'.
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesErrorIncorrectValueDateToArray()
{
$this->oCases->getList(array(
'userId' => '00000000000000000000000000000001',
'dateTo' => '2014-44-44'
));
}
/**
* Test error for incorrect value $process in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @expectedException Exception
* @expectedExceptionMessage The value '2014-44-44' is not a valid date for the format 'Y-m-d'.
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesErrorIncorrectValueDateFromArray()
{
$this->oCases->getList(array(
'userId' => '00000000000000000000000000000001',
'dateFrom' => '2014-44-44'
));
}
/**
* Test get list to do not paged
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesToDoNotPaged()
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'paged' => false));
$this->assertTrue(is_array($response));
$this->assertFalse(isset($response['data']));
$this->assertFalse(isset($response['total']));
$this->assertFalse(isset($response['start']));
$this->assertFalse(isset($response['limit']));
$this->assertFalse(isset($response['sort']));
$this->assertFalse(isset($response['dir']));
$this->assertFalse(isset($response['cat_uid']));
$this->assertFalse(isset($response['pro_uid']));
$this->assertFalse(isset($response['search']));
}
/**
* Test get list to do
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
@@ -217,44 +104,14 @@ class CasesTest extends \PHPUnit_Framework_TestCase
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001'));
$this->assertTrue(is_array($response));
$this->assertTrue(is_numeric($response['totalCount']));
$this->assertTrue(is_array($response['data']));
$this->assertTrue(isset($response['total']));
$this->assertTrue(isset($response['start']));
$this->assertTrue(isset($response['limit']));
$this->assertTrue(isset($response['sort']));
$this->assertTrue(isset($response['dir']));
$this->assertTrue(isset($response['cat_uid']));
$this->assertTrue(isset($response['pro_uid']));
$this->assertTrue(isset($response['search']));
}
/**
* Test get list draft not paged
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesDraftNotPaged()
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'draft', 'paged' => false));
$this->assertTrue(is_array($response));
$this->assertFalse(isset($response['data']));
$this->assertFalse(isset($response['total']));
$this->assertFalse(isset($response['start']));
$this->assertFalse(isset($response['limit']));
$this->assertFalse(isset($response['sort']));
$this->assertFalse(isset($response['dir']));
$this->assertFalse(isset($response['cat_uid']));
$this->assertFalse(isset($response['pro_uid']));
$this->assertFalse(isset($response['search']));
}
/**
* Test get list draft
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
@@ -263,44 +120,14 @@ class CasesTest extends \PHPUnit_Framework_TestCase
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'draft'));
$this->assertTrue(is_array($response));
$this->assertTrue(is_numeric($response['totalCount']));
$this->assertTrue(is_array($response['data']));
$this->assertTrue(isset($response['total']));
$this->assertTrue(isset($response['start']));
$this->assertTrue(isset($response['limit']));
$this->assertTrue(isset($response['sort']));
$this->assertTrue(isset($response['dir']));
$this->assertTrue(isset($response['cat_uid']));
$this->assertTrue(isset($response['pro_uid']));
$this->assertTrue(isset($response['search']));
}
/**
* Test get list participated not paged
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesParticipatedNotPaged()
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'sent', 'paged' => false));
$this->assertTrue(is_array($response));
$this->assertFalse(isset($response['data']));
$this->assertFalse(isset($response['total']));
$this->assertFalse(isset($response['start']));
$this->assertFalse(isset($response['limit']));
$this->assertFalse(isset($response['sort']));
$this->assertFalse(isset($response['dir']));
$this->assertFalse(isset($response['cat_uid']));
$this->assertFalse(isset($response['pro_uid']));
$this->assertFalse(isset($response['search']));
}
/**
* Test get list participated
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
@@ -309,44 +136,14 @@ class CasesTest extends \PHPUnit_Framework_TestCase
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'sent'));
$this->assertTrue(is_array($response));
$this->assertTrue(is_numeric($response['totalCount']));
$this->assertTrue(is_array($response['data']));
$this->assertTrue(isset($response['total']));
$this->assertTrue(isset($response['start']));
$this->assertTrue(isset($response['limit']));
$this->assertTrue(isset($response['sort']));
$this->assertTrue(isset($response['dir']));
$this->assertTrue(isset($response['cat_uid']));
$this->assertTrue(isset($response['pro_uid']));
$this->assertTrue(isset($response['search']));
}
/**
* Test get list unassigned not paged
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesUnassignedNotPaged()
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'unassigned', 'paged' => false));
$this->assertTrue(is_array($response));
$this->assertFalse(isset($response['data']));
$this->assertFalse(isset($response['total']));
$this->assertFalse(isset($response['start']));
$this->assertFalse(isset($response['limit']));
$this->assertFalse(isset($response['sort']));
$this->assertFalse(isset($response['dir']));
$this->assertFalse(isset($response['cat_uid']));
$this->assertFalse(isset($response['pro_uid']));
$this->assertFalse(isset($response['search']));
}
/**
* Test get list unassigned
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
@@ -355,48 +152,14 @@ class CasesTest extends \PHPUnit_Framework_TestCase
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'unassigned'));
$this->assertTrue(is_array($response));
$this->assertTrue(is_numeric($response['totalCount']));
$this->assertTrue(is_array($response['data']));
$this->assertTrue(isset($response['total']));
$this->assertTrue(isset($response['start']));
$this->assertTrue(isset($response['limit']));
$this->assertTrue(isset($response['sort']));
$this->assertTrue(isset($response['dir']));
$this->assertTrue(isset($response['cat_uid']));
$this->assertTrue(isset($response['pro_uid']));
$this->assertTrue(isset($response['search']));
}
/**
* Test get list search not paged
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
public function testGetListCasesSearchNotPaged()
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'search', 'paged' => false));
$this->assertTrue(is_array($response));
$this->assertFalse(isset($response['data']));
$this->assertFalse(isset($response['total']));
$this->assertFalse(isset($response['start']));
$this->assertFalse(isset($response['limit']));
$this->assertFalse(isset($response['sort']));
$this->assertFalse(isset($response['dir']));
$this->assertFalse(isset($response['cat_uid']));
$this->assertFalse(isset($response['pro_uid']));
$this->assertFalse(isset($response['search']));
$this->assertFalse(isset($response['app_status']));
$this->assertFalse(isset($response['usr_uid']));
$this->assertFalse(isset($response['date_from']));
$this->assertFalse(isset($response['date_to']));
}
/**
* Test get list search
*
* @covers \ProcessMaker\BusinessModel\Cases::getList
* @covers \BusinessModel\Cases::getList
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
@@ -405,122 +168,8 @@ class CasesTest extends \PHPUnit_Framework_TestCase
{
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'search'));
$this->assertTrue(is_array($response));
$this->assertTrue(is_numeric($response['totalCount']));
$this->assertTrue(is_array($response['data']));
$this->assertTrue(isset($response['total']));
$this->assertTrue(isset($response['start']));
$this->assertTrue(isset($response['limit']));
$this->assertTrue(isset($response['sort']));
$this->assertTrue(isset($response['dir']));
$this->assertTrue(isset($response['cat_uid']));
$this->assertTrue(isset($response['pro_uid']));
$this->assertTrue(isset($response['search']));
$this->assertTrue(isset($response['app_status']));
$this->assertTrue(isset($response['usr_uid']));
$this->assertTrue(isset($response['date_from']));
$this->assertTrue(isset($response['date_to']));
}
/**
* Test add Case
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
*
* @copyright Colosa - Bolivia
*/
public function testAddCase()
{
$response = $this->oCases->addCase('1265557095225ff5c688f46031700471', '46941969352af5be2ab3f39001216717', '00000000000000000000000000000001', array('name' => 'John', 'lastname' => 'Petersson'));
$this->assertTrue(is_object($response));
$aResponse = json_decode(json_encode($response), true);
return $aResponse;
}
/**
* Test get Task Case
*
* @covers \ProcessMaker\BusinessModel\Cases::getTaskCase
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testGetTaskCase(array $aResponse)
{
$response = $this->oCases->getTaskCase($aResponse['app_uid'], '00000000000000000000000000000001');
$this->assertTrue(is_array($response));
}
/**
* Test get Case Info
*
* @covers \ProcessMaker\BusinessModel\Cases::getCaseInfo
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testGetCaseInfo(array $aResponse)
{
$response = $this->oCases->getCaseInfo($aResponse['app_uid'], '00000000000000000000000000000001');
$this->assertTrue(is_object($response));
}
/**
* Test put reassign case
*
* @covers \ProcessMaker\BusinessModel\Cases::getCaseInfo
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testUpdateReassignCase(array $aResponse)
{
$response = $this->oCases->updateReassignCase($aResponse['app_uid'], '00000000000000000000000000000001', null, '00000000000000000000000000000001', '73005191052d56727901138030694610');
$this->assertTrue(empty($response));
}
/**
* Test add Case to test route case
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseRouteCase()
{
$response = $this->oCases->addCase('1265557095225ff5c688f46031700471', '46941969352af5be2ab3f39001216717', '00000000000000000000000000000001', array('name' => 'John', 'lastname' => 'Petersson'));
$this->assertTrue(is_object($response));
$aResponseRouteCase = json_decode(json_encode($response), true);
return $aResponseRouteCase;
}
/**
* Test put route case
*
* @covers \ProcessMaker\BusinessModel\Cases::updateRouteCase
* @depends testAddCaseRouteCase
* @param array $aResponseRouteCase
*
* @copyright Colosa - Bolivia
*/
public function testUpdateRouteCase(array $aResponseRouteCase)
{
$response = $this->oCases->updateRouteCase($aResponseRouteCase['app_uid'], '00000000000000000000000000000001', null);
$this->assertTrue(empty($response));
}
/**
* Test add Case impersonate
*
* @covers \ProcessMaker\BusinessModel\Cases::addCaseImpersonate
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseImpersonate()
{
$response = $this->oCases->addCaseImpersonate('1265557095225ff5c688f46031700471', '73005191052d56727901138030694610', '46941969352af5be2ab3f39001216717', array(array('name' => 'John', 'lastname' => 'Petersson')));
$this->assertTrue(is_object($response));
}
}

View File

@@ -0,0 +1,356 @@
<?php
namespace Tests\BusinessModel;
if (!class_exists("Propel")) {
include_once (__DIR__ . "/../bootstrap.php");
}
/**
* Class Cases Test
*
* @copyright Colosa - Bolivia
*
* @protected
* @package Tests\BusinessModel
*/
class CasesTest extends \PHPUnit_Framework_TestCase
{
protected $oCases;
protected $idCase = '';
protected static $usrUid = "00000000000000000000000000000001";
protected static $usrUid2 = "00000000000000000000000000000012";
protected static $proUid = "00000000000000000000000000000003";
protected static $tasUid = "00000000000000000000000000000004";
protected static $tasUid2 = "00000000000000000000000000000005";
protected static $tasUid3 = "00000000000000000000000000000006";
public static function setUpBeforeClass()
{
$process = new \Process();
$process->create(array("type"=>"classicProject", "PRO_TITLE"=> "NEW TEST PHP UNIT", "PRO_DESCRIPTION"=> "465",
"PRO_CATEGORY"=> "", "PRO_CREATE_USER"=> "00000000000000000000000000000001",
"PRO_UID"=> self::$proUid, "USR_UID"=> "00000000000000000000000000000001"), false);
$task = new \Task();
$task->create(array("TAS_START"=>"TRUE", "TAS_UID"=> self::$tasUid, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TEST PHP UNIT",
"TAS_POSX"=> 581, "TAS_POSY"=> 47, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
$task = new \Task();
$task->create(array( "TAS_UID"=> self::$tasUid2, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK ONE",
"TAS_POSX"=> 481, "TAS_POSY"=> 127, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
$task = new \Task();
$task->create(array( "TAS_UID"=> self::$tasUid3, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TWO",
"TAS_POSX"=> 681, "TAS_POSY"=> 127, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
$nw = new \processMap();
$nw->saveNewPattern(self::$proUid, self::$tasUid, self::$tasUid2, 'PARALLEL', true);
$nw = new \processMap();
$nw->saveNewPattern(self::$proUid, self::$tasUid, self::$tasUid3, 'PARALLEL', true);
$user = new \Users();
$user->create(array("USR_ROLE"=> "PROCESSMAKER_ADMIN","USR_UID"=> self::$usrUid2, "USR_USERNAME"=> "dummy",
"USR_PASSWORD"=>"21232f297a57a5a743894a0e4a801fc3", "USR_FIRSTNAME"=>"dummy_firstname", "USR_LASTNAME"=>"dummy_lastname",
"USR_EMAIL"=>"dummy@dummy.com", "USR_DUE_DATE"=>'2020-01-01', "USR_CREATE_DATE"=>"2014-01-01 12:00:00", "USR_UPDATE_DATE"=>"2014-01-01 12:00:00",
"USR_STATUS"=>"ACTIVE", "USR_UX"=>"NORMAL"));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid2, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid2, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid2, "USR_UID"=> self::$usrUid2, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid3, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid3, "USR_UID"=> self::$usrUid2, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
}
/**
* Set class for test
*
* @coversNothing
*
* @copyright Colosa - Bolivia
*/
public function setUp()
{
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
return true;
}
/**
* Test error for incorrect value of process in array
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
* @expectedException Exception
* @expectedExceptionMessage Invalid process 12345678912345678912345678912345678
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseErrorIncorrectProcessValueArray()
{
$this->oCases->addCase('12345678912345678912345678912345678', self::$tasUid, self::$usrUid, array());
}
/**
* Test error for incorrect value of task in array
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
* @expectedException Exception
* @expectedExceptionMessage Task invalid or the user is not assigned to the task
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseErrorIncorrectTaskValueArray()
{
$this->oCases->addCase(self::$proUid, '12345678912345678912345678912345678', self::$usrUid, array());
}
/**
* Test add Case
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
*
* @copyright Colosa - Bolivia
*/
public function testAddCase()
{
$response = $this->oCases->addCase(self::$proUid, self::$tasUid, self::$usrUid, array());
$this->assertTrue(is_object($response));
$aResponse = json_decode(json_encode($response), true);
return $aResponse;
}
/**
* Test error for incorrect value of case in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getTaskCase
* @expectedException Exception
* @expectedExceptionMessage Incorrect or unavailable information about this case: 12345678912345678912345678912345678
*
* @copyright Colosa - Bolivia
*/
public function testGetTaskCaseErrorIncorrectCaseValueArray()
{
$this->oCases->getTaskCase('12345678912345678912345678912345678', self::$usrUid);
}
/**
* Test get Task Case
*
* @covers \ProcessMaker\BusinessModel\Cases::getTaskCase
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testGetTaskCase(array $aResponse)
{
$response = $this->oCases->getTaskCase($aResponse['app_uid'], self::$usrUid);
$this->assertTrue(is_array($response));
}
/**
* Test error for incorrect value of case in array
*
* @covers \ProcessMaker\BusinessModel\Cases::getCaseInfo
* @expectedException Exception
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
*
* @copyright Colosa - Bolivia
*/
public function testGetCaseInfoErrorIncorrectCaseValueArray()
{
$this->oCases->getCaseInfo('12345678912345678912345678912345678', self::$usrUid);
}
/**
* Test get Case Info
*
* @covers \ProcessMaker\BusinessModel\Cases::getCaseInfo
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testGetCaseInfo(array $aResponse)
{
$response = $this->oCases->getCaseInfo($aResponse['app_uid'], self::$usrUid);
$this->assertTrue(is_object($response));
}
/**
* Test error for incorrect value of user delegation in array
*
* @covers \ProcessMaker\BusinessModel\Cases::updateReassignCase
* @depends testAddCase
* @param array $aResponse
* @expectedException Exception
* @expectedExceptionMessage Invalid Case Delegation index for this user
*
* @copyright Colosa - Bolivia
*/
public function testUpdateReassignCaseErrorIncorrectUserValueArray(array $aResponse)
{
$this->oCases->updateReassignCase($aResponse['app_uid'], self::$usrUid, null, self::$usrUid, self::$usrUid2);
}
/**
* Test error for incorrect value of case in array
*
* @covers \ProcessMaker\BusinessModel\Cases::updateReassignCase
* @expectedException Exception
* @expectedExceptionMessage The Application with app_uid: 12345678912345678912345678912345678 doesn't exist
*
* @copyright Colosa - Bolivia
*/
public function testUpdateReassignCaseErrorIncorrectCaseValueArray()
{
$this->oCases->updateReassignCase('12345678912345678912345678912345678', self::$usrUid, null, self::$usrUid2, self::$usrUid);
}
/**
* Test put reassign case
*
* @covers \ProcessMaker\BusinessModel\Cases::updateReassignCase
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testUpdateReassignCase(array $aResponse)
{
$response = $this->oCases->updateReassignCase($aResponse['app_uid'], self::$usrUid, null, self::$usrUid2, self::$usrUid);
$this->assertTrue(empty($response));
}
/**
* Test add Case to test route case
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseRouteCase()
{
$response = $this->oCases->addCase(self::$proUid, self::$tasUid, self::$usrUid, array());
$this->assertTrue(is_object($response));
$aResponseRouteCase = json_decode(json_encode($response), true);
return $aResponseRouteCase;
}
/**
* Test error for incorrect value of case in array
*
* @covers \ProcessMaker\BusinessModel\Cases::updateRouteCase
* @expectedException Exception
* @expectedExceptionMessage The row '12345678912345678912345678912345678, ' in table AppDelegation doesn't exist!
*
* @copyright Colosa - Bolivia
*/
public function testUpdateRouteCaseErrorIncorrectCaseValueArray()
{
$this->oCases->updateRouteCase('12345678912345678912345678912345678', self::$usrUid, null);
}
/**
* Test put route case
*
* @covers \ProcessMaker\BusinessModel\Cases::updateRouteCase
* @depends testAddCaseRouteCase
* @param array $aResponseRouteCase
*
* @copyright Colosa - Bolivia
*/
public function testUpdateRouteCase(array $aResponseRouteCase)
{
$response = $this->oCases->updateRouteCase($aResponseRouteCase['app_uid'], self::$usrUid, null);
$this->assertTrue(empty($response));
}
/**
* Test error for incorrect value of process in array
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
* @expectedException Exception
* @expectedExceptionMessage Invalid process 12345678912345678912345678912345678
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseImpersonateErrorIncorrectProcessValueArray()
{
$this->oCases->addCaseImpersonate('12345678912345678912345678912345678', self::$usrUid2, self::$tasUid, array());
}
/**
* Test error for incorrect value of task in array
*
* @covers \ProcessMaker\BusinessModel\Cases::addCase
* @expectedException Exception
* @expectedExceptionMessage User not registered! 12345678912345678912345678912345678!!
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseImpersonateErrorIncorrectTaskValueArray()
{
$this->oCases->addCaseImpersonate(self::$proUid, '12345678912345678912345678912345678', self::$tasUid, array());
}
/**
* Test add Case impersonate
*
* @covers \ProcessMaker\BusinessModel\Cases::addCaseImpersonate
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseImpersonate()
{
$response = $this->oCases->addCaseImpersonate(self::$proUid, self::$usrUid2, self::$tasUid, array());
$this->assertTrue(is_object($response));
}
public static function tearDownAfterClass()
{
$assign = new \TaskUser();
$assign->remove(self::$tasUid, self::$usrUid, 1,1);
$task = new \Task();
$task->remove(self::$tasUid);
$task = new \Task();
$task->remove(self::$tasUid2);
$task = new \Task();
$task->remove(self::$tasUid3);
$process = new \Process();
$process->remove(self::$proUid);
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\RoutePeer::PRO_UID);
$criteria->add(\RoutePeer::PRO_UID, self::$proUid, \Criteria::EQUAL);
\ProcessFilesPeer::doDelete($criteria);
$user = new \Users();
$user->remove(self::$usrUid2);
$oConnection = \Propel::getConnection( \UsersPeer::DATABASE_NAME );
try {
$oUser = \UsersPeer::retrieveByPK( self::$usrUid2 );
if (! is_null( $oUser )) {
$oConnection->begin();
$oUser->delete();
$oConnection->commit();
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
}

View File

@@ -18,6 +18,53 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
protected $oInputDocument;
protected $idCase = '';
protected static $usrUid = "00000000000000000000000000000001";
protected static $proUid = "00000000000000000000000000000002";
protected static $tasUid = "00000000000000000000000000000003";
protected static $inpUid = "00000000000000000000000000000004";
protected static $steUid = "00000000000000000000000000000005";
public static function setUpBeforeClass()
{
$process = new \Process();
$process->create(array("type"=>"classicProject", "PRO_TITLE"=> "NEW TEST PHP UNIT", "PRO_DESCRIPTION"=> "465",
"PRO_CATEGORY"=> "", "PRO_CREATE_USER"=> "00000000000000000000000000000001",
"PRO_UID"=> self::$proUid, "USR_UID"=> "00000000000000000000000000000001"), false);
$task = new \Task();
$task->create(array("TAS_START"=>"TRUE", "TAS_UID"=> self::$tasUid, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TEST PHP UNIT",
"TAS_POSX"=> 581, "TAS_POSY"=> 17, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
$inputDocument = new \InputDocument();
$inputDocument->create(array("INP_DOC_UID"=> self::$inpUid, "PRO_UID"=> self::$proUid, "INP_DOC_TITLE"=> "INPUTDOCUMENT TEST UNIT", "INP_DOC_FORM_NEEDED"=> "VIRTUAL",
"INP_DOC_ORIGINAL"=> "ORIGINAL", "INP_DOC_DESCRIPTION"=> "", "INP_DOC_VERSIONING"=> "",
"INP_DOC_DESTINATION_PATH"=> "", "INP_DOC_TAGS"=> "INPUT", "ACCEPT"=> "Save", "BTN_CANCEL"=>"Cancel"));
$step = new \Step();
$step->create(array( "PRO_UID"=> self::$proUid, "TAS_UID"=> self::$tasUid, "STEP_UID"=> self::$steUid, "STEP_TYPE_OBJ" => "INPUT_DOCUMENT", "STEP_UID_OBJ" =>self::$inpUid));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
}
public static function tearDownAfterClass()
{
$assign = new \TaskUser();
$assign->remove(self::$tasUid, self::$usrUid, 1,1);
$step = new \Step();
$step->remove(self::$steUid);
$inputDocument = new \InputDocument();
$inputDocument->remove(self::$inpUid);
$task = new \Task();
$task->remove(self::$tasUid);
$process = new \Process();
$process->remove(self::$proUid);
}
/**
* Set class for test
*
@@ -39,19 +86,29 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
public function testAddInputDocument()
{
\G::loadClass('pmFunctions');
\G::loadClass('pmFunctions');
$usrUid = '00000000000000000000000000000001';//an user id valid
$proUid = '1265557095225ff5c688f46031700471';//a process id valid
$tasUid = '46941969352af5be2ab3f39001216717';//a task id valid and related to the previous proUid
$inpDocUid = '70158392952979dedd77fe0058957493';//a input document id valid and related to the previous task id
$idCase = PMFNewCase($proUid, $usrUid, $tasUid, array());
$idCase = PMFNewCase(self::$proUid, self::$usrUid, self::$tasUid, array());
$case = new \Cases();
$appDocUid = $case->addInputDocument($inpDocUid, $appDocUid = \G::generateUniqueID(), '', 'INPUT',
$appDocUid = $case->addInputDocument(self::$inpUid, $appDocUid = \G::generateUniqueID(), '', 'INPUT',
'PHPUNIT TEST', '', $idCase, \AppDelegation::getCurrentIndex($idCase),
$tasUid, $usrUid, "xmlform", '/home/user/desarrollo/test.txt', 0, '/home/user/desarrollo/test.txt');
self::$tasUid, self::$usrUid, "xmlform", PATH_DATA_SITE.'db.php',
0, PATH_DATA_SITE.'db.php');
$aResponse = array();
$aResponse = array_merge(array("idCase" => $idCase, "appDocUid" => $appDocUid, "inpDocUid" => $inpDocUid), $aResponse);
$aResponse = array_merge(array("idCase" => $idCase, "appDocUid" => $appDocUid, "inpDocUid" => self::$inpUid), $aResponse);
return $aResponse;
}
/**
* Test error for incorrect value of case in array
*
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocuments
* @expectedException Exception
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
*
* @copyright Colosa - Bolivia
*/
public function testGetCasesInputDocumentsErrorIncorrectCaseValueArray()
{
$this->oInputDocument->getCasesInputDocuments('12345678912345678912345678912345678', self::$usrUid);
}
/**
@@ -65,10 +122,42 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
*/
public function testGetCasesInputDocuments(array $aResponse)
{
$response = $this->oInputDocument->getCasesInputDocuments($aResponse["idCase"], '00000000000000000000000000000001');
$response = $this->oInputDocument->getCasesInputDocuments($aResponse["idCase"], self::$usrUid);
$this->assertTrue(is_array($response));
}
/**
* Test error for incorrect value of task in array
*
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocument
* @depends testAddInputDocument
* @param array $aResponse
* @expectedException Exception
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
*
* @copyright Colosa - Bolivia
*/
public function testGetCasesInputDocumentErrorIncorrectCaseValueArray(array $aResponse)
{
$this->oInputDocument->getCasesInputDocument('12345678912345678912345678912345678', self::$usrUid, $aResponse["appDocUid"]);
}
/**
* Test error for incorrect value of input document in array
*
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocument
* @depends testAddInputDocument
* @param array $aResponse
* @expectedException Exception
* @expectedExceptionMessage This input document with id: 12345678912345678912345678912345678 doesn't exist!
*
* @copyright Colosa - Bolivia
*/
public function testGetCasesInputDocumentErrorIncorrectInputDocumentValueArray(array $aResponse)
{
$this->oInputDocument->getCasesInputDocument($aResponse["idCase"], self::$usrUid, '12345678912345678912345678912345678');
}
/**
* Test get InputDocument
*
@@ -80,10 +169,26 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
*/
public function testGetCasesInputDocument(array $aResponse)
{
$response = $this->oInputDocument->getCasesInputDocument($aResponse["idCase"], '00000000000000000000000000000001', $aResponse["appDocUid"]);
$response = $this->oInputDocument->getCasesInputDocument($aResponse["idCase"], self::$usrUid, $aResponse["appDocUid"]);
$this->assertTrue(is_object($response));
}
/**
* Test error for incorrect value of input document in array
*
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::removeInputDocument
* @depends testAddInputDocument
* @param array $aResponse
* @expectedException Exception
* @expectedExceptionMessage This input document with id: 12345678912345678912345678912345678 doesn't exist!
*
* @copyright Colosa - Bolivia
*/
public function testGetCasesInputDocumentErrorIncorrectApplicationValueArray(array $aResponse)
{
$this->oInputDocument->removeInputDocument('12345678912345678912345678912345678');
}
/**
* Test remove InputDocument
*

View File

@@ -18,6 +18,59 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
protected $oOutputDocument;
protected $idCase = '';
protected static $usrUid = "00000000000000000000000000000001";
protected static $proUid = "00000000000000000000000000000002";
protected static $tasUid = "00000000000000000000000000000003";
protected static $outUid = "00000000000000000000000000000004";
protected static $steUid = "00000000000000000000000000000005";
public static function setUpBeforeClass()
{
$process = new \Process();
$process->create(array("type"=>"classicProject", "PRO_TITLE"=> "NEW TEST PHP UNIT", "PRO_DESCRIPTION"=> "465",
"PRO_CATEGORY"=> "", "PRO_CREATE_USER"=> "00000000000000000000000000000001",
"PRO_UID"=> self::$proUid, "USR_UID"=> "00000000000000000000000000000001"), false);
$task = new \Task();
$task->create(array("TAS_START"=>"TRUE", "TAS_UID"=> self::$tasUid, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TEST PHP UNIT",
"TAS_POSX"=> 581, "TAS_POSY"=> 17, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
$outputDocument = new \OutputDocument();
$outputDocument->create(array("OUT_DOC_UID"=> self::$outUid, "PRO_UID"=> self::$proUid, "OUT_DOC_TITLE"=> "NEW OUPUT TEST", "OUT_DOC_FILENAME"=> "NEW_OUPUT_TEST",
"OUT_DOC_DESCRIPTION"=> "", "OUT_DOC_REPORT_GENERATOR"=> "HTML2PDF", "OUT_DOC_REPORT_GENERATOR_label"=> "HTML2PDF (Old Version)",
"OUT_DOC_LANDSCAPE"=> "", "OUT_DOC_LANDSCAPE_label"=> "Portrait", "OUT_DOC_GENERATE"=> "BOTH", "OUT_DOC_GENERATE_label"=> "BOTH",
"OUT_DOC_VERSIONING"=> "", "OUT_DOC_VERSIONING_label"=> "NO", "OUT_DOC_MEDIA"=> "Letter", "OUT_DOC_MEDIA_label"=> "Letter",
"OUT_DOC_LEFT_MARGIN"=> "", "OUT_DOC_RIGHT_MARGIN"=> "", "OUT_DOC_TOP_MARGIN"=> "", "OUT_DOC_BOTTOM_MARGIN"=> "",
"OUT_DOC_DESTINATION_PATH"=> "", "OUT_DOC_TAGS"=> "", "OUT_DOC_PDF_SECURITY_ENABLED"=> "0", "OUT_DOC_PDF_SECURITY_ENABLED_label"=> "Disabled",
"OUT_DOC_PDF_SECURITY_OPEN_PASSWORD"=>"", "OUT_DOC_PDF_SECURITY_OWNER_PASSWORD"=> "", "OUT_DOC_PDF_SECURITY_PERMISSIONS"=> "",
"OUT_DOC_OPEN_TYPE"=> "0", "OUT_DOC_OPEN_TYPE_label"=> "Download the file", "BTN_CANCEL"=> "Cancel", "ACCEPT"=> "Save"));
$step = new \Step();
$step->create(array( "PRO_UID"=> self::$proUid, "TAS_UID"=> self::$tasUid, "STEP_UID"=> self::$steUid, "STEP_TYPE_OBJ" => "OUTPUT_DOCUMENT", "STEP_UID_OBJ" =>self::$outUid));
$assign = new \TaskUser();
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
}
public static function tearDownAfterClass()
{
$assign = new \TaskUser();
$assign->remove(self::$tasUid, self::$usrUid, 1,1);
$step = new \Step();
$step->remove(self::$steUid);
$outputDocument = new \OutputDocument();
$outputDocument->remove(self::$outUid);
$task = new \Task();
$task->remove(self::$tasUid);
$process = new \Process();
$process->remove(self::$proUid);
}
/**
* Set class for test
*
@@ -40,13 +93,8 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
public function testAddCasesOutputDocument()
{
\G::loadClass('pmFunctions');
\G::loadClass('pmFunctions');
$usrUid = '00000000000000000000000000000001';//an user id valid
$proUid = '1265557095225ff5c688f46031700471';//a process id valid
$tasUid = '46941969352af5be2ab3f39001216717';//a task id valid and related to the previous proUid
$outDocUid = '64016692453346d546d0ad1037377043';//a output document id valid and related to the previous task id
$idCase = PMFNewCase($proUid, $usrUid, $tasUid, array());
$response = $this->oOutputDocument->addCasesOutputDocument($idCase, $outDocUid, '00000000000000000000000000000001');
$idCase = PMFNewCase(self::$proUid, self::$usrUid, self::$tasUid, array());
$response = $this->oOutputDocument->addCasesOutputDocument($idCase, self::$outUid, self::$usrUid);
$this->assertTrue(is_object($response));
$aResponse = json_decode(json_encode($response), true);
$aResponse = array_merge(array("idCase" => $idCase), $aResponse);
@@ -64,7 +112,7 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
*/
public function testGetCasesOutputDocuments(array $aResponse)
{
$response = $this->oOutputDocument->getCasesOutputDocuments($aResponse["idCase"], '00000000000000000000000000000001');
$response = $this->oOutputDocument->getCasesOutputDocuments($aResponse["idCase"], self::$usrUid);
$this->assertTrue(is_array($response));
}
@@ -79,7 +127,7 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
*/
public function testGetCasesOutputDocument(array $aResponse)
{
$response = $this->oOutputDocument->getCasesOutputDocument($aResponse["idCase"], '00000000000000000000000000000001', $aResponse["app_doc_uid"]);
$response = $this->oOutputDocument->getCasesOutputDocument($aResponse["idCase"], self::$usrUid, $aResponse["app_doc_uid"]);
$this->assertTrue(is_object($response));
}
@@ -96,5 +144,9 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
{
$response = $this->oOutputDocument->removeOutputDocument($aResponse["app_doc_uid"]);
$this->assertTrue(empty($response));
//remove Case
$case = new \Cases();
$case->removeCase( $aResponse["idCase"] );
}
}