Arreglo de conflictos

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-04-03 12:20:34 -04:00
16 changed files with 484 additions and 206 deletions

View File

@@ -2,7 +2,7 @@
<project name="ProcessMaker Michelangelo" default="build-phpcs"> <project name="ProcessMaker Michelangelo" default="build-phpcs">
<target name="build" <target name="build"
depends="prepare,lint,phploc,pdepend,phpcs-ci,phpdox, behat"/> depends="prepare,lint,phploc,pdepend,phpcs-ci,phpunit,phpdox,behat"/>
<target name="build-simple" <target name="build-simple"
depends="prepare,phpunit,phpcs-ci,phploc,lint"/> depends="prepare,phpunit,phpcs-ci,phploc,lint"/>
@@ -122,7 +122,12 @@
</target> </target>
<target name="phpunit" description="Run unit tests with PHPUnit"> <target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="false"/> <exec executable="phpunit">
<arg value="--testsuite" />
<arg path="api" />
<arg value="--bootstrap" />
<arg path="${basedir}/workflow/engine/src/Tests/bootstrap.php" />
</exec>
</target> </target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser"> <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">

View File

@@ -1,33 +1,68 @@
@ProcessMakerMichelangelo @RestAPI @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: 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: Background:
Given that I have a valid access_token Given that I have a valid access_token
Scenario: Returns information about a given case of the list Inbox #Listado de casos
Given I request "cases/48177942153275bfa28bd04070312685" 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 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the "app_uid" property equals "48177942153275bfa28bd04070312685" And the response has 14 records
And the "app_number" property equals 16
And the "app_name" property equals "#16"
And the "app_status" property equals "TO_DO"
And the "app_init_usr_uid" property equals "00000000000000000000000000000001"
And the "app_init_usr_username" property equals "Administrator"
And the "pro_uid" property equals "99209594750ec27ea338927000421575"
And the "pro_name" property equals "Derivation rules - sequential"
And the "app_create_date" property equals "2014-03-17 16:32:58"
And the "app_update_date" property equals "2014-03-17 16:33:01"
Scenario: Returns the current task for a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685/current-task" 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 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the response has 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
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"
And the type is "object"
And the "app_uid" property equals "220090038533b0c40688174019225585"
And the "app_number" property equals 137
And the "app_name" property equals "#137"
And the "app_status" property equals "TO_DO"
Scenario: Returns the current task for a given case of the list Inbox, case 167 of process "derivation rules - sequencial"
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 "object"
And the "tas_uid" property equals "73641967750ec281cf015d9009265327" And the "tas_uid" property equals "73641967750ec281cf015d9009265327"
And the "tas_title" property equals "Cyclical" And the "tas_title" property equals "Cyclical"
And the "del_index" property equals "2" And the "del_index" property equals "2"
@@ -37,8 +72,8 @@ Scenario Outline: Create a new case in workspace with process "Derivation rules
Given POST this data: Given POST this data:
""" """
{ {
"pro_uid": "99209594750ec27ea338927000421575", "pro_uid": "<pro_uid>",
"tas_uid": "68707275350ec281ada1c95068712556", "tas_uid": "<tas_uid>",
"variables": [{"name": "admin", "lastname":"admin"}] "variables": [{"name": "admin", "lastname":"admin"}]
} }
""" """
@@ -47,12 +82,14 @@ Scenario Outline: Create a new case in workspace with process "Derivation rules
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "object" And the type is "object"
And store "caseId" in session array as variable "caseId_<case_number>" And store "app_uid" in session array as variable "app_uid_<case_number>"
And store "caseNumber" in session array as variable "caseNumber_<case_number>" And store "app_number" in session array as variable "app_number_<case_number>"
Examples: Examples:
| case_number | | Description | case_number | pro_uid | tas_uid |
| 1 | | Create case 16 in draft | 1 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
| Create case 17 in draft | 2 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
| Create case 18 in draft | 5 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 |
Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential" Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential"
@@ -60,7 +97,7 @@ Scenario Outline: Create a new case Impersonate in workspace with process "Deriv
""" """
{ {
"pro_uid": "99209594750ec27ea338927000421575", "pro_uid": "99209594750ec27ea338927000421575",
"usr_uid": "24166330352d56730cdd525035621101", "usr_uid": "<usr_uid>",
"tas_uid": "68707275350ec281ada1c95068712556", "tas_uid": "68707275350ec281ada1c95068712556",
"variables": [{"name": "pruebaQA", "amount":"10400"}] "variables": [{"name": "pruebaQA", "amount":"10400"}]
} }
@@ -70,12 +107,13 @@ Scenario Outline: Create a new case Impersonate in workspace with process "Deriv
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "object" And the type is "object"
And store "caseId" in session array as variable "caseId_<case_number>" And store "app_uid" in session array as variable "app_uid_<case_number>"
And store "caseNumber" in session array as variable "caseNumber_<case_number>" And store "app_number" in session array as variable "app_number_<case_number>"
Examples: Examples:
| case_number | | Description | case_number | usr_uid |
| 1 | | Create new case 18 with user chris | 3 | 24166330352d56730cdd525035621101 |
| Create new case 18 with user adam | 4 | 44811996752d567110634a1013636964 |
Scenario: Returns a list of the cases for the logged in user (Draft) Scenario: Returns a list of the cases for the logged in user (Draft)
@@ -83,36 +121,195 @@ Scenario: Returns a list of the cases for the logged in user (Draft)
Then the response status code should be 200 Then the response status code should be 200
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "array" And the type is "array"
And the response has 2 records And the response has 18 records
Scenario: Reassigns a case to a different user Scenario Outline: Reassigns a case to a different user, from user "administrator" to user "aaron"
Given PUT this data: Given PUT this data:
""" """
{ {
"usr_uid_source": "62625000752d5672d6661e6072881167", "usr_uid_source": "00000000000000000000000000000001",
"usr_uid_target": "24166330352d56730cdd525035621101", "usr_uid_target": "51049032352d56710347233042615067"
} }
""" """
And that I want to update a resource with the key "case_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_<case_number>"
And I request "case/{uid}/reassign-case" Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
Examples:
| test_description | case_number |
| Reassig case 1, created in this script | 1 |
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 2 to inbox of Administrator, created in this script | 2 |
Scenario Outline: Cancel a case
Given 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"
Examples:
| test_description | case_number |
| Cancel case 3, created in this script | 3 |
Scenario Outline: Pause a case
Given 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 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 |
| Pause case 4, created in this script | 4 |
Scenario Outline: Unpause a case
Given PUT this data:
"""
{
}
"""
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"
And the type is "object"
Examples:
| test_description | case_number |
| Unpause case 4, created in this script | 4 |
Scenario Outline: Executes a ProcessMaker trigger for a case
Given PUT this data:
"""
{
}
"""
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 Then the response status code should be 200
And the content type is "application/json" And the content type is "application/json"
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "object" And the type is "object"
Scenario: Autoderivate a case to the next task in the process Examples:
| test_description | case_number | tri_uid |
| Ejecucion de trigger | 5 | 54962158250ec613ba5bc89016850103 |
Scenario Outline: Delete a case
Given PUT this data: Given PUT this data:
""" """
{ {
"case_uid": "78ef3ca7905019270643749052af5bd7",
"del_index": "1"
} }
""" """
And that I want to update a resource with the key "" stored in session array
And I request "case/{uid}/route-case" 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 Then the response status code should be 200
And the content type is "application/json" And the content type is "application/json"
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "object" And the type is "object"
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 |
#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 "array"
And the response has 14 records
Scenario: Returns a list of the cases for the logged in user (Draft)
Given I request "cases/draft"
Then the response status code should be 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

@@ -6,6 +6,48 @@ Requirements:
Background: Background:
Given that I have a valid access_token Given that I have a valid access_token
#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 "array"
And the response has 14 records
Scenario: Returns a list of the cases for the logged in user (Draft)
Given I request "cases/draft"
Then the response status code should be 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
Scenario: Returns information about a given case of the list Inbox Scenario: Returns information about a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685" Given I request "cases/48177942153275bfa28bd04070312685"
Then the response status code should be 200 Then the response status code should be 200

View File

@@ -26,5 +26,4 @@ Scenario: Create a new case note for specified case
Then the response status code should be 201 Then the response status code should be 201
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "object" And the type is "object"

View File

@@ -1,4 +1,4 @@
ProcessMakerMichelangelo @RestAPI @ProcessMakerMichelangelo @RestAPI
Feature: Case Note Negative Tests Feature: Case Note Negative Tests
Requirements: Requirements:
a workspace with three cases of the process "Test Users-Step-Properties End Point" a workspace with three cases of the process "Test Users-Step-Properties End Point"

View File

@@ -46,10 +46,7 @@ Scenario: Returns the variables can be system variables and/or case variables.
And the "date3" property equals "2014-03-03" And the "date3" property equals "2014-03-03"
And the "date4" property equals "2014-03-01" And the "date4" property equals "2014-03-01"
And the "suggest2" property equals "51049032352d56710347233042615067" And the "suggest2" property equals "51049032352d56710347233042615067"
And the "suggest2_label" property equals "aaron" And the "suggest2_label" property equals "aaron"
And the "sample" property in row 1 of property "grid" equals "jose" And the "sample" property in row 1 of property "grid" equals "jose"
And the "currency1" property equals "12,334,444.00" And the "currency1" property equals "12,334,444.00"
And the "percentage1" property equals "333.00 %" And the "percentage1" property equals "333.00 %"

View File

@@ -38,58 +38,4 @@ Scenario: Sends variables to a case (negative tests)
Then the response status code should be 200 Then the response status code should be 200
And the content type is "application/json" And the content type is "application/json"
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the type is "object" And the type is "object"
18130826553359171798e40060879912
"nameany": "wendy344%",
"namealphabetic": "nestor123",
"namealphanumeric": "rad1233$%",
"nameinteger": "342432,7",
"namerealnumber": "35353",
"nameemail": "wendycolosacom",
"namelogin": "sample",
"valorreal": "242343253,253.00",
"valorinteger": "346436363",
"porcentagereal": "64600",
"porcentageinteger": "464",
"observaciones": "ninguna",
"areascolosa": "sample",
"areascolosa_label": "sample",
"COUNTRY": "BOA",
"COUNTRY_label": "Bolivia",
"STATE": "aH",
"STATE_label": "Chuquisaca",
"LOCATION": "SRE",
"LOCATION_label": "Sucre",
"aprobado": "20",
"aprobadohint": "0",
"checkbox1": "sample",
"checkbox2": "oki",
"checkbox3": "Off",
"radiogroup1": "hola",
"radiogroup1_label": "Primero",
"date1": "hola",
"date2": "2013-11-08",
"date3": "2014-03-09",
"date4": "2014-03-02",
"suggest2": "51049032352d56710347233042615067",
"suggest2_label": "sample",
"grid": {
"1": {
"sample": "hugo",
"currency1": "2,424,234.00",
"percentage1": "354.00 %",
"suggest1_label": "dorothy",
"suggest1": "81205219852d56719a97fc3086456770",
"textarea1": "ninguno",
"dropdown1": "uno",
"yesno1": "0",
"checkbox1": "On",
"date1": "2014-03-20",
"link1": "http://www.google.com/",
"link1_label": "link1",
"file1": "Tuesday.docx",
"dropdown1_label": "uno"

View File

@@ -59,21 +59,21 @@ Scenario: Returns a list of the cases for the logged in user (Advanced-Search)
#Scenarios para filtros y paginacion de las listas #Scenarios para filtros y paginacion en listas
Scenario Outline: Get paging of list inbox Scenario Outline: Get paging of list inbox
Given I request "cases/paged?Start=<start>&limit=<limit>" Given I request "cases/paged?start=<start>&limit=<limit>"
Then the response status code should be <http_code> Then the response status code should be <http_code>
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
| test_description | start | limit | records | http_code | | test_description | start | limit | records | http_code |
| lowercase in Start | a | 1 | 1 | 200 | | lowercase in start | a | 1 | 1 | 200 |
| uppercase in Start | A | 1 | 1 | 200 | | uppercase in start | A | 1 | 1 | 200 |
| lowercase in Limit | 1 | a | 14 | 200 | | lowercase in Limit | 1 | a | 14 | 200 |
| uppercase in Limit | 1 | A | 14 | 200 | | uppercase in Limit | 1 | A | 14 | 200 |
| limit=3 | 1 | 3 | 3 | 200 | | limit=3 | 1 | 3 | 3 | 200 |
@@ -104,7 +104,7 @@ Scenario Outline: Get order type of Descending and Acending
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -119,7 +119,7 @@ Scenario Outline: Get order type of Process Category
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -134,7 +134,7 @@ Scenario Outline: Get order type of Process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -149,7 +149,7 @@ Scenario Outline: Get order type of Search of number the process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -167,18 +167,18 @@ Scenario: Returns a list of the cases for the logged in user (Draft)
Scenario Outline: Get paging of list Draft Scenario Outline: Get paging of list Draft
Given I request "cases/draft/paged?Start=<start>&limit=<limit>" Given I request "cases/draft/paged?start=<start>&limit=<limit>"
Then the response status code should be <http_code> Then the response status code should be <http_code>
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
| test_description | start | limit | records | http_code | | test_description | start | limit | records | http_code |
| lowercase in Start | a | 1 | 1 | 200 | | lowercase in start | a | 1 | 1 | 200 |
| uppercase in Start | A | 1 | 1 | 200 | | uppercase in start | A | 1 | 1 | 200 |
| lowercase in Limit | 1 | a | 15 | 200 | | lowercase in Limit | 1 | a | 15 | 200 |
| uppercase in Limit | 1 | A | 15 | 200 | | uppercase in Limit | 1 | A | 15 | 200 |
| limit=3 | 1 | 3 | 3 | 200 | | limit=3 | 1 | 3 | 3 | 200 |
@@ -209,7 +209,7 @@ Scenario Outline: Get order type of Descending and Ascending
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -225,7 +225,7 @@ Scenario Outline: Get order type of Process Category
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -240,7 +240,7 @@ Scenario Outline: Get order type of Process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -255,7 +255,7 @@ Scenario Outline: Get order type of Search of the process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -272,18 +272,18 @@ Scenario: Returns a list of the cases for the logged in user (Participated)
And the response has 30 records And the response has 30 records
Scenario Outline: Get paging of list Participated Scenario Outline: Get paging of list Participated
Given I request "cases/participated/paged?Start=<start>&limit=<limit>" Given I request "cases/participated/paged?start=<start>&limit=<limit>"
Then the response status code should be <http_code> Then the response status code should be <http_code>
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
| test_description | start | limit | records | http_code | | test_description | start | limit | records | http_code |
| lowercase in Start | a | 1 | 1 | 200 | | lowercase in start | a | 1 | 1 | 200 |
| uppercase in Start | A | 1 | 1 | 200 | | uppercase in start | A | 1 | 1 | 200 |
| lowercase in Limit | 1 | a | 30 | 200 | | lowercase in Limit | 1 | a | 30 | 200 |
| uppercase in Limit | 1 | A | 30 | 200 | | uppercase in Limit | 1 | A | 30 | 200 |
| limit=3 | 1 | 3 | 3 | 200 | | limit=3 | 1 | 3 | 3 | 200 |
@@ -314,7 +314,7 @@ Scenario Outline: Get order type of Descending an Descending
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -330,7 +330,7 @@ Scenario Outline: Get order type of Process Category
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -345,7 +345,7 @@ Scenario Outline: Get order type of Process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -361,7 +361,7 @@ Scenario Outline: Get order type of Search
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -379,18 +379,18 @@ Scenario: Returns a list of the cases for the logged in user (Unassigned)
Scenario Outline: Get paging of list 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> Then the response status code should be <http_code>
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
| test_description | start | limit | records | http_code | | test_description | start | limit | records | http_code |
| lowercase in Start | a | 1 | 1 | 200 | | lowercase in start | a | 1 | 1 | 200 |
| uppercase in Start | A | 1 | 1 | 200 | | uppercase in start | A | 1 | 1 | 200 |
| lowercase in Limit | 1 | a | 12 | 200 | | lowercase in Limit | 1 | a | 12 | 200 |
| uppercase in Limit | 1 | A | 12 | 200 | | uppercase in Limit | 1 | A | 12 | 200 |
| limit=3 | 1 | 3 | 3 | 200 | | limit=3 | 1 | 3 | 3 | 200 |
@@ -421,7 +421,7 @@ Scenario Outline: Get order type of Descending and Acending
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -436,7 +436,7 @@ Scenario Outline: Get order type of Process Category
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -451,7 +451,7 @@ Scenario Outline: Get order type of Process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -466,7 +466,7 @@ Scenario Outline: Get order type of Search
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -485,18 +485,18 @@ Scenario: Returns a list of the cases for the logged in user (Paused)
Scenario Outline: Get paging of list Paused Scenario Outline: Get paging of list Paused
Given I request "cases/paused/paged?Start=<start>&limit=<limit>" Given I request "cases/paused/paged?start=<start>&limit=<limit>"
Then the response status code should be <http_code> Then the response status code should be <http_code>
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
| test_description | start | limit | records | http_code | | test_description | start | limit | records | http_code |
| lowercase in Start | a | 1 | 1 | 200 | | lowercase in start | a | 1 | 1 | 200 |
| uppercase in Start | A | 1 | 1 | 200 | | uppercase in start | A | 1 | 1 | 200 |
| lowercase in Limit | 1 | a | 12 | 200 | | lowercase in Limit | 1 | a | 12 | 200 |
| uppercase in Limit | 1 | A | 12 | 200 | | uppercase in Limit | 1 | A | 12 | 200 |
| limit=3 | 1 | 3 | 3 | 200 | | limit=3 | 1 | 3 | 3 | 200 |
@@ -527,7 +527,7 @@ Scenario Outline: Get order type of Descending and Acending
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -542,7 +542,7 @@ Scenario Outline: Get order type of Process Category
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -557,7 +557,7 @@ Scenario Outline: Get order type of Process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -572,7 +572,7 @@ Scenario Outline: Get order type of Search
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -590,18 +590,18 @@ Scenario: Returns a list of the cases for the logged in user (Advanced Search)
Scenario Outline: Get paging of list Advanced Search Scenario Outline: Get paging of list Advanced Search
Given I request "cases/advanced-search/paged?Start=<start>&limit=<limit>" Given I request "cases/advanced-search/paged?start=<start>&limit=<limit>"
Then the response status code should be <http_code> Then the response status code should be <http_code>
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
| test_description | start | limit | records | http_code | | test_description | start | limit | records | http_code |
| lowercase in Start | a | 1 | 1 | 200 | | lowercase in start | a | 1 | 1 | 200 |
| uppercase in Start | A | 1 | 1 | 200 | | uppercase in start | A | 1 | 1 | 200 |
| lowercase in Limit | 1 | a | 30 | 200 | | lowercase in Limit | 1 | a | 30 | 200 |
| uppercase in Limit | 1 | A | 30 | 200 | | uppercase in Limit | 1 | A | 30 | 200 |
| limit=3 | 1 | 3 | 3 | 200 | | limit=3 | 1 | 3 | 3 | 200 |
@@ -632,7 +632,7 @@ Scenario Outline: Get order type of Descending and Acending
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -647,7 +647,7 @@ Scenario Outline: Get order type of Process Category
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -663,7 +663,7 @@ Scenario Outline: Get order type of Process
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -679,7 +679,7 @@ Scenario Outline: Get order type of Search
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -694,7 +694,7 @@ Scenario Outline: Get order for Status
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -711,7 +711,7 @@ Scenario Outline: Get order for User
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:
@@ -728,7 +728,7 @@ Scenario Outline: Get order for date
And the response charset is "UTF-8" And the response charset is "UTF-8"
And the content type is "application/json" And the content type is "application/json"
And the type is "array" And the type is "array"
And the response has <records> records in property "data" And the response has <records> records
Examples: Examples:

View File

@@ -9,38 +9,38 @@ Scenario: Returns a list of the cases for the logged in user (Inbox)
Given I request "cases" Given I request "cases"
Then the response status code should be 400 Then the response status code should be 400
And the response has 4 records 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 "Records"
Scenario: Returns a list of the cases for the logged in user (Draft) Scenario: Returns a list of the cases for the logged in user (Draft)
Given I request "cases/draft" Given I request "cases/draft"
Then the response status code should be 400 Then the response status code should be 400
And the response has 4 records 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 "Records"
Scenario: Returns a list of the cases for the logged in user (Participated) Scenario: Returns a list of the cases for the logged in user (Participated)
Given I request "cases/participated" Given I request "cases/participated"
Then the response status code should be 400 Then the response status code should be 400
And the response has 4 records 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 "Records"
Scenario: Returns a list of the cases for the logged in user (Unassigned) Scenario: Returns a list of the cases for the logged in user (Unassigned)
Given I request "cases/unassigned" Given I request "cases/unassigned"
Then the response status code should be 400 Then the response status code should be 400
And the response has 4 records 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 "Records"
Scenario: Returns a list of the cases for the logged in user (Paused) Scenario: Returns a list of the cases for the logged in user (Paused)
Given I request "cases/paused" Given I request "cases/paused"
Then the response status code should be 400 Then the response status code should be 400
And the response has 4 records 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 "Records"
Scenario: Returns a list of the cases for the logged in user (Advanced Search) Scenario: Returns a list of the cases for the logged in user (Advanced Search)
Given I request "cases/advanced-search" Given I request "cases/advanced-search"
Then the response status code should be 400 Then the response status code should be 400
And the response has 4 records 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 "Records"

View File

@@ -41,7 +41,7 @@ Scenario: Generate or regenerates an output documents for a given case
Scenario: Delete an uploaded or generated document from a case. Scenario: Delete an uploaded or generated document from a case.
And that I want to delete a resource with the key "app_doc_uid_0" stored in session array And that I want to delete a resource with the key "app_doc_uid_0" stored in session array
Gie I request "output-document" Given I request "output-document"
Then the response status code should be 200 Then the response status code should be 200
And the content type is "application/json" And the content type is "application/json"
And the response charset is "UTF-8" And the response charset is "UTF-8"

View File

@@ -1,3 +1,12 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Output Documents cases Main Tests
Requirements:
a workspace with one case of the process "Test Output Document Case"
and there are six Output Documents in the process
Background:
Given that I have a valid access_token
Scenario Outline: Pull information of an inexistent input document. should return an error Scenario Outline: Pull information of an inexistent input document. should return an error
Given I request "cases/64654381053382b8bb4c415067063003/input-document/<input-document>" Given I request "cases/64654381053382b8bb4c415067063003/input-document/<input-document>"
Then the response status code should be 200 Then the response status code should be 200

View File

@@ -1,14 +1,15 @@
<?php <?php
namespace Maveriks; namespace Maveriks;
use ProcessMaker\Services\Api;
use Maveriks\Util; use Maveriks\Util;
use Luracast\Restler\RestException; use ProcessMaker\Services;
class WebApplication class WebApplication
{ {
protected $rootDir = ""; protected $rootDir = "";
protected $workflowDir = ""; protected $workflowDir = "";
protected $workspaceDir = "";
protected $workspaceCacheDir = "";
protected $requestUri = ""; protected $requestUri = "";
protected $responseMultipart = array(); protected $responseMultipart = array();
@@ -86,7 +87,7 @@ class WebApplication
} else { } else {
$this->dispatchApiRequest($request["uri"], $request["version"]); $this->dispatchApiRequest($request["uri"], $request["version"]);
} }
Util\Logger::log("API::End Dispatching ".$_SERVER["REQUEST_METHOD"]." ".$request["uri"]); Util\Logger::log("API::End Dispatch");
break; break;
} }
} }
@@ -105,19 +106,10 @@ class WebApplication
public function multipart($uri, $version = "1.0") public function multipart($uri, $version = "1.0")
{ {
$stringInput = file_get_contents('php://input'); $stringInput = file_get_contents('php://input');
if (empty($stringInput)) { if (is_null($stringInput)) {
$rest = new \Maveriks\Extension\Restler(); return array(); //no body
$rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart without body."));
exit();
} else {
$input = json_decode($stringInput);
if (empty($input->calls)) {
$rest = new \Maveriks\Extension\Restler();
$rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart body without calls."));
exit();
}
} }
$input = json_decode($stringInput);
$baseUrl = (empty($input->base_url)) ? $uri : $input->base_url; $baseUrl = (empty($input->base_url)) ? $uri : $input->base_url;
foreach($input->calls as $value) { foreach($input->calls as $value) {
@@ -152,6 +144,8 @@ class WebApplication
*/ */
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');
require_once $this->rootDir . "framework/src/Maveriks/Extension/Restler/UploadFormat.php";
// $servicesDir contains directory where Services Classes are allocated // $servicesDir contains directory where Services Classes are allocated
$servicesDir = $this->workflowDir . 'engine' . DS . 'src' . DS . 'ProcessMaker' . DS . 'Services' . DS; $servicesDir = $this->workflowDir . 'engine' . DS . 'src' . DS . 'ProcessMaker' . DS . 'Services' . DS;
// $apiDir - contains directory to scan classes and add them to Restler // $apiDir - contains directory to scan classes and add them to Restler
@@ -166,15 +160,27 @@ class WebApplication
/* /*
* Load Api ini file for Rest Service * Load Api ini file for Rest Service
*/ */
$apiIniConf = array(); $config = array();
if (file_exists($apiIniFile)) { if (file_exists($apiIniFile)) {
$apiIniConf = Util\Common::parseIniFile($apiIniFile); $cachedConfig = $this->workspaceCacheDir . "api-config.php";
// verify if config cache file exists, is array and the last modification date is the same when cache was created.
if (! file_exists($cachedConfig) || ! is_array($config = include($cachedConfig)) || $config["_chk"] != filemtime($apiIniFile)) {
$config = Util\Common::parseIniFile($apiIniFile);
$config["_chk"] = filemtime($apiIniFile);
if (! is_dir(dirname($cachedConfig))) {
Util\Common::mk_dir(dirname($cachedConfig));
}
file_put_contents($cachedConfig, "<?php return " . var_export($config, true).";");
Util\Logger::log("Configuration cache was loaded and cached to: $cachedConfig");
} else {
Util\Logger::log("Loading Api Configuration from: $cachedConfig");
}
} }
// Setting current workspace to Api class // Setting current workspace to Api class
\ProcessMaker\Services\Api::setWorkspace(SYS_SYS); Services\Api::setWorkspace(SYS_SYS);
// TODO remove this setting on the future, it is not needed, but if it is not present is throwing a warning
//\Luracast\Restler\Format\HtmlFormat::$viewPath = $servicesDir . 'oauth2/views';
// create a new Restler instance // create a new Restler instance
//$rest = new \Luracast\Restler\Restler(); //$rest = new \Luracast\Restler\Restler();
@@ -190,20 +196,13 @@ class WebApplication
// Setting database connection source // Setting database connection source
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, ''); list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
$port = empty($port) ? '' : ";port=$port"; $port = empty($port) ? '' : ";port=$port";
\ProcessMaker\Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port); Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
// Setting default OAuth Client id, for local PM Web Designer // Setting default OAuth Client id, for local PM Web Designer
\ProcessMaker\Services\OAuth2\Server::setPmClientId($pmOauthClientId); Services\OAuth2\Server::setPmClientId($pmOauthClientId);
require_once $this->workflowDir . "engine/src/Extension/Restler/UploadFormat.php";
//require_once PATH_CORE
//$rest->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat');
//$rest->setOverridingFormats('UploadFormat', 'JsonFormat', 'XmlFormat', 'HtmlFormat');
$rest->setOverridingFormats('JsonFormat', 'UploadFormat'); $rest->setOverridingFormats('JsonFormat', 'UploadFormat');
// Override $_SERVER['REQUEST_URI'] to Restler handles the current url correctly
$isPluginRequest = strpos($uri, '/plugin-') !== false ? true : false; $isPluginRequest = strpos($uri, '/plugin-') !== false ? true : false;
if ($isPluginRequest) { if ($isPluginRequest) {
@@ -215,6 +214,7 @@ class WebApplication
$uri = str_replace('/plugin-'.$pluginName, '', $uri); $uri = str_replace('/plugin-'.$pluginName, '', $uri);
} }
// Override $_SERVER['REQUEST_URI'] to Restler handles the modified url
$_SERVER['REQUEST_URI'] = $uri; $_SERVER['REQUEST_URI'] = $uri;
if (! $isPluginRequest) { // if it is not a request for a plugin endpoint if (! $isPluginRequest) { // if it is not a request for a plugin endpoint
@@ -224,19 +224,17 @@ class WebApplication
foreach ($classesList as $classFile) { foreach ($classesList as $classFile) {
if (pathinfo($classFile, PATHINFO_EXTENSION) === 'php') { if (pathinfo($classFile, PATHINFO_EXTENSION) === 'php') {
$namespace = '\\ProcessMaker\\Services\\' . str_replace( $namespace = '\\ProcessMaker\\Services\\' . str_replace(
DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
'\\', '\\',
str_replace('.php', '', str_replace($servicesDir, '', $classFile)) str_replace('.php', '', str_replace($servicesDir, '', $classFile))
); );
//var_dump($namespace); die;
$rest->addAPIClass($namespace); $rest->addAPIClass($namespace);
} }
} }
// adding aliases for Restler // adding aliases for Restler
//print_r($apiIniConf); if (array_key_exists('alias', $config)) {
if (array_key_exists('alias', $apiIniConf)) { foreach ($config['alias'] as $alias => $aliasData) {
foreach ($apiIniConf['alias'] as $alias => $aliasData) {
if (is_array($aliasData)) { if (is_array($aliasData)) {
foreach ($aliasData as $label => $namespace) { foreach ($aliasData as $label => $namespace) {
$namespace = '\\' . ltrim($namespace, '\\'); $namespace = '\\' . ltrim($namespace, '\\');
@@ -391,7 +389,10 @@ class WebApplication
require_once (PATH_DB . SYS_SYS . "/db.php"); require_once (PATH_DB . SYS_SYS . "/db.php");
// defining constant for workspace shared directory // defining constant for workspace shared directory
define("PATH_WORKSPACE", PATH_DB . SYS_SYS . PATH_SEP); $this->workspaceDir = PATH_DB . SYS_SYS . PATH_SEP;
$this->workspaceCacheDir = PATH_DB . SYS_SYS . PATH_SEP . "cache" . PATH_SEP;
define("PATH_WORKSPACE", $this->workspaceDir);
// including workspace shared classes -> particularlly for pmTables // including workspace shared classes -> particularlly for pmTables
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE); set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE);

View File

@@ -20,6 +20,9 @@
<directory>./tests/unit/</directory> <directory>./tests/unit/</directory>
</testsuite> </testsuite>
--> -->
<testsuite name="api">
<directory>./workflow/engine/src/</directory>
</testsuite>
</testsuites> </testsuites>
<!-- <filter> <!-- <filter>

View File

@@ -261,7 +261,9 @@ class ProcessCategory
} }
//Return //Return
if ($oProcessCategory != '') { if ($oProcessCategory != '') {
return $oProcessCategory; $oProcessCategory = array_change_key_case($oProcessCategory, CASE_LOWER);
$oResponse = json_decode(json_encode($oProcessCategory), false);
return $oResponse;
} else { } else {
throw (new \Exception( 'The Category with cat_uid: '.$cat_uid.' doesn\'t exist!')); throw (new \Exception( 'The Category with cat_uid: '.$cat_uid.' doesn\'t exist!'));
} }
@@ -291,7 +293,7 @@ class ProcessCategory
$pcat->setCategoryUid( $catUid ); $pcat->setCategoryUid( $catUid );
$pcat->setCategoryName( $catName ); $pcat->setCategoryName( $catName );
$pcat->save(); $pcat->save();
$oProcessCategory = array_change_key_case($this->getCategory( $catUid ), CASE_LOWER); $oProcessCategory = $this->getCategory( $catUid );
//Return //Return
return $oProcessCategory; return $oProcessCategory;
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -321,9 +323,10 @@ class ProcessCategory
$pcat->setCategoryUid( $catUID ); $pcat->setCategoryUid( $catUID );
$pcat->setCategoryName( $catName ); $pcat->setCategoryName( $catName );
$pcat->save(); $pcat->save();
$oProcessCategory = array_change_key_case($this->getCategory( $cat_uid ), CASE_LOWER); $oProcessCategory = $this->getCategory( $cat_uid );
//Return //Return
return $oProcessCategory; $oResponse = json_decode(json_encode($oProcessCategory), false);
return $oResponse;
} catch (\Exception $e) { } catch (\Exception $e) {
throw $e; throw $e;

View File

@@ -8,11 +8,25 @@ if (!class_exists("Propel")) {
/** /**
* Class ProcessCategoryTest * Class ProcessCategoryTest
* *
* @package Tests\BusinessModel * @package Tests/ProcessMaker/BusinessModel
*/ */
class ProcessCategoryTest extends \PHPUnit_Framework_TestCase class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
{ {
protected static $arrayUid = array(); protected static $arrayUid = array();
protected $oCategory;
/**
* Set class for test
*
* @coversNothing
*
* @copyright Colosa - Bolivia
*/
public function setUp()
{
$this->oCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
}
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
@@ -26,6 +40,67 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
} }
} }
/**
* Test add Category
*
* @covers \BusinessModel\ProcessCategory::addCategory
*
* @copyright Colosa - Bolivia
*/
public function testAddCategory()
{
$response = $this->oCategory->addCategory('New Category Test');
$this->assertTrue(is_object($response));
$aResponse = json_decode(json_encode($response), true);
return $aResponse;
}
/**
* Test put Category
*
* @covers \BusinessModel\ProcessCategory::updateCategory
* @depends testAddCategory
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testUpdateCategory(array $aResponse)
{
$response = $this->oCategory->updateCategory($aResponse["cat_uid"], 'Name Update Category Test');
$this->assertTrue(is_object($response));
}
/**
* Test get Category
*
* @covers \BusinessModel\ProcessCategory::getCategory
* @depends testAddCategory
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testGetCategory(array $aResponse)
{
$response = $this->oCategory->getCategory($aResponse["cat_uid"]);
$this->assertTrue(is_object($response));
}
/**
* Test delete Category
*
* @covers \BusinessModel\ProcessCategory::deleteCategory
* @depends testAddCategory
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testDeleteCategory(array $aResponse)
{
$response = $this->oCategory->deleteCategory($aResponse["cat_uid"]);
$this->assertTrue(empty($response));
}
public function testCreate() public function testCreate()
{ {
try { try {
@@ -46,6 +121,7 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
$this->assertNotEmpty($processCategoryUid); $this->assertNotEmpty($processCategoryUid);
} }
public function testGetCategories() public function testGetCategories()
{ {
$processCategory = new \ProcessMaker\BusinessModel\ProcessCategory(); $processCategory = new \ProcessMaker\BusinessModel\ProcessCategory();