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

@@ -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 ();

File diff suppressed because it is too large Load Diff

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}
*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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"] );
}
}