diff --git a/build.xml b/build.xml index 9377409c4..f6478e432 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,7 @@ + depends="prepare,lint,phploc,pdepend,phpcs-ci,phpunit,phpdox,behat"/> @@ -122,7 +122,12 @@ - + + + + + + diff --git a/features/backend/application_cases/case_actions/basic_sequence_cases_actions.feature b/features/backend/application_cases/case_actions/basic_sequence_cases_actions.feature index a93042222..c9d78e232 100644 --- a/features/backend/application_cases/case_actions/basic_sequence_cases_actions.feature +++ b/features/backend/application_cases/case_actions/basic_sequence_cases_actions.feature @@ -82,13 +82,14 @@ Scenario Outline: Create a new case in workspace with process "Derivation rules And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" - And store "caseId" in session array as variable "caseId_" - And store "caseNumber" in session array as variable "caseNumber_" + And store "app_uid" in session array as variable "app_uid_" + And store "app_number" in session array as variable "app_number_" Examples: | Description | case_number | pro_uid | tas_uid | | 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" @@ -106,8 +107,8 @@ Scenario Outline: Create a new case Impersonate in workspace with process "Deriv And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" - And store "caseId" in session array as variable "caseId_" - And store "caseNumber" in session array as variable "caseNumber_" + And store "app_uid" in session array as variable "app_uid_" + And store "app_number" in session array as variable "app_number_" Examples: | Description | case_number | usr_uid | @@ -128,16 +129,15 @@ Scenario Outline: Reassigns a case to a different user, from user "administrator """ { "usr_uid_source": "00000000000000000000000000000001", - "usr_uid_target": "51049032352d56710347233042615067", + "usr_uid_target": "51049032352d56710347233042615067" } """ - And I request "case//reassign-case" + And I request "cases/app_uid/reassign-case" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 200 And the content type is "application/json" And the response charset is "UTF-8" And the type is "object" - And that I want to update a resource with the key "case_number" stored in session array as variable "caseNumber_" - And that I want to update a resource with the key "caseId" stored in session array as variable "caseId_" + Examples: @@ -145,7 +145,7 @@ Scenario Outline: Reassigns a case to a different user, from user "administrator | Reassig case 1, created in this script | 1 | -Scenario: Route a case to the next task in the process +Scenario Outline: Route a case to the next task in the process Given PUT this data: """ { @@ -153,14 +153,12 @@ Scenario: Route a case to the next task in the process "del_index": "1" } """ - And I request "cases//route-case" + And I request "cases/app_uid/route-case" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 200 And the content type is "application/json" And the response charset is "UTF-8" And the type is "object" - And that I want to update a resource with the key "case_number" stored in session array as variable "caseNumber_" - And that I want to update a resource with the key "caseId" stored in session array as variable "caseId_" - + Examples: @@ -169,21 +167,19 @@ Scenario: Route a case to the next task in the process -Scenario: Cancel a case +Scenario Outline: Cancel a case Given PUT this data: """ { } """ - And I request "cases//cancel" + And I request "cases/app_uid/cancel" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 200 And the content type is "application/json" And the response charset is "UTF-8" And the type is "object" - And that I want to update a resource with the key "case_number" stored in session array as variable "caseNumber_" - And that I want to update a resource with the key "caseId" stored in session array as variable "caseId_" - + Examples: @@ -191,21 +187,19 @@ Scenario: Cancel a case | Cancel case 3, created in this script | 3 | -Scenario: Pause a case +Scenario Outline: Pause a case Given PUT this data: """ { "unpaused_date": "2016-12-12" } """ - And I request "cases//pause" + And I request "cases/app_uid/pause" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 200 And the content type is "application/json" And the response charset is "UTF-8" And the type is "object" - And that I want to update a resource with the key "case_number" stored in session array as variable "caseNumber_" - And that I want to update a resource with the key "caseId" stored in session array as variable "caseId_" - + Examples: @@ -213,21 +207,19 @@ Scenario: Pause a case | Pause case 4, created in this script | 4 | -Scenario: Unpause a case +Scenario Outline: Unpause a case Given PUT this data: """ { } """ - And I request "cases//unpause" + And I request "cases/app_uid/unpause" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 200 And the content type is "application/json" And the response charset is "UTF-8" And the type is "object" - And that I want to update a resource with the key "case_number" stored in session array as variable "caseNumber_" - And that I want to update a resource with the key "caseId" stored in session array as variable "caseId_" - + Examples: @@ -235,42 +227,41 @@ Scenario: Unpause a case | Unpause case 4, created in this script | 4 | -Scenario: Executes a ProcessMaker trigger for a case +Scenario Outline: Executes a ProcessMaker trigger for a case Given PUT this data: """ { } """ - And I request "cases//execute-trigger/{tri_uid}" + And I request "cases/app_uid/execute-trigger/" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 200 And the content type is "application/json" And the response charset is "UTF-8" And the type is "object" - And that I want to update a resource with the key "case_number" stored in session array as variable "caseNumber_" - And that I want to update a resource with the key "caseId" stored in session array as variable "caseId_" Examples: - | test_description | case_number | - | | | + | test_description | case_number | tri_uid | + | Ejecucion de trigger | 5 | 54962158250ec613ba5bc89016850103 | -Scenario: Delete a case +Scenario Outline: Delete a case Given PUT this data: """ { } """ - And I request "cases/" + + And that I want to delete a resource with the key "app_uid" stored in session array as variable "app_uid_" + And I request "cases" Then the response status code should be 200 And the content type is "application/json" And the response charset is "UTF-8" And the type is "object" - And that I want to update a resource with the key "case_number" stored in session array as variable "caseNumber_" - And that I want to update a resource with the key "caseId" stored in session array as variable "caseId_" + Examples: @@ -280,6 +271,7 @@ Scenario: Delete a case | 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 diff --git a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature index cac5b2773..0efeb5ef9 100644 --- a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature +++ b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature @@ -48,21 +48,21 @@ Scenario: Returns a list of the cases for the logged in user (Paused) And the response has 12 records -Scenario: Returns information about a given case of the list Inbox - Given I request "cases/48177942153275bfa28bd04070312685" +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 "array" - And the "app_uid" property equals "48177942153275bfa28bd04070312685" - And the "app_number" property equals 16 - And the "app_name" property equals "#16" + 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" 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" + And the "pro_uid" property equals "35894775350ec7daa099378048029617" + And the "pro_name" property equals "Derivation rules - Parallel" + And the "app_create_date" property equals "2014-04-01 14:58:08" + And the "app_update_date" property equals "2014-04-01 14:58:20" Scenario: Returns the current task for a given case of the list Inbox diff --git a/features/backend/application_cases/case_note/main_tests_case_note.feature b/features/backend/application_cases/case_note/main_tests_case_note.feature index 3d2c6c233..d0268b94e 100644 --- a/features/backend/application_cases/case_note/main_tests_case_note.feature +++ b/features/backend/application_cases/case_note/main_tests_case_note.feature @@ -26,5 +26,4 @@ Scenario: Create a new case note for specified case Then the response status code should be 201 And the response charset is "UTF-8" And the content type is "application/json" - And the type is "object" - \ No newline at end of file + And the type is "object" \ No newline at end of file diff --git a/features/backend/application_cases/case_note/negative_tests_case_note.feature b/features/backend/application_cases/case_note/negative_tests_case_note.feature index aa92b5d44..9000c45e0 100644 --- a/features/backend/application_cases/case_note/negative_tests_case_note.feature +++ b/features/backend/application_cases/case_note/negative_tests_case_note.feature @@ -1,4 +1,4 @@ -ProcessMakerMichelangelo @RestAPI +@ProcessMakerMichelangelo @RestAPI Feature: Case Note Negative Tests Requirements: a workspace with three cases of the process "Test Users-Step-Properties End Point" diff --git a/features/backend/application_cases/case_variables/main_tests_case_variables.feature b/features/backend/application_cases/case_variables/main_tests_case_variables.feature index 4fcfa9613..528f33be3 100644 --- a/features/backend/application_cases/case_variables/main_tests_case_variables.feature +++ b/features/backend/application_cases/case_variables/main_tests_case_variables.feature @@ -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 "date4" property equals "2014-03-01" 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 "currency1" property equals "12,334,444.00" And the "percentage1" property equals "333.00 %" diff --git a/features/backend/application_cases/case_variables/negative_tests_case_variables.feature b/features/backend/application_cases/case_variables/negative_tests_case_variables.feature index 3dfdc81ca..c47891fdb 100644 --- a/features/backend/application_cases/case_variables/negative_tests_case_variables.feature +++ b/features/backend/application_cases/case_variables/negative_tests_case_variables.feature @@ -38,58 +38,4 @@ Scenario: Sends variables to a case (negative tests) 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" - - - - 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" \ No newline at end of file + And the type is "object" \ No newline at end of file diff --git a/features/backend/application_cases/output_document_case/basic_sequence_output_document_case.feature b/features/backend/application_cases/output_document_case/basic_sequence_output_document_case.feature index 74db0a059..eaf808238 100644 --- a/features/backend/application_cases/output_document_case/basic_sequence_output_document_case.feature +++ b/features/backend/application_cases/output_document_case/basic_sequence_output_document_case.feature @@ -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. 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 And the content type is "application/json" And the response charset is "UTF-8" diff --git a/features/backend/application_cases/output_document_case/negative_tests_output_document_case.feature b/features/backend/application_cases/output_document_case/negative_tests_output_document_case.feature index e9e8713aa..4d3b0aec7 100644 --- a/features/backend/application_cases/output_document_case/negative_tests_output_document_case.feature +++ b/features/backend/application_cases/output_document_case/negative_tests_output_document_case.feature @@ -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 Given I request "cases/64654381053382b8bb4c415067063003/input-document/" Then the response status code should be 200 diff --git a/features/backend/projects/process_permissions/basic_sequence_permissions.feature b/features/backend/projects/process_permissions/basic_sequence_permissions.feature index 9d772d2ac..448910dcf 100644 --- a/features/backend/projects/process_permissions/basic_sequence_permissions.feature +++ b/features/backend/projects/process_permissions/basic_sequence_permissions.feature @@ -1,4 +1,4 @@ -miche@ProcessMakerMichelangelo @RestAPI +@ProcessMakerMichelangelo @RestAPI Feature: ProcessPermissions Resources @1: TEST FOR GET PROCESS PERMISSIONS /---------------------------------------------------------------------- diff --git a/framework/src/Maveriks/Extension/Restler.php b/framework/src/Maveriks/Extension/Restler.php index e4f043839..c60c3d163 100644 --- a/framework/src/Maveriks/Extension/Restler.php +++ b/framework/src/Maveriks/Extension/Restler.php @@ -3,6 +3,9 @@ namespace Maveriks\Extension; use Luracast\Restler\Defaults; use Luracast\Restler\Format\UrlEncodedFormat; +use ProcessMaker\Services\Api; +use Luracast\Restler\RestException; + /** * Class Restler * Extension Restler class to implement in ProcessMaker @@ -103,4 +106,20 @@ class Restler extends \Luracast\Restler\Restler } return $includeQueryParameters ? $get : array(); //no body } + + /** + * This method call the function message + * + * @param RestException $e. Exception the error + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return void + */ + public function setMessage(RestException $e) + { + $this->message($e); + } } \ No newline at end of file diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 8d645659f..edc86752e 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -3,6 +3,8 @@ namespace Maveriks; use Maveriks\Util; use ProcessMaker\Services; +use ProcessMaker\Services\Api; +use Luracast\Restler\RestException; class WebApplication { @@ -106,10 +108,19 @@ class WebApplication public function multipart($uri, $version = "1.0") { $stringInput = file_get_contents('php://input'); - if (is_null($stringInput)) { - return array(); //no body + if (empty($stringInput)) { + $rest = new \Maveriks\Extension\Restler(); + $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; foreach($input->calls as $value) { diff --git a/phpunit.xml b/phpunit.xml index d3ed5e4d7..fe75d4cad 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,7 +2,7 @@ ./tests/unit/ --> + + ./workflow/engine/src/ +