From 7bc831c4e9e0057b65b49ed29afae4c252609de5 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Wed, 2 Apr 2014 16:35:31 -0400 Subject: [PATCH 01/15] Se agrega test unit para PROCESS CATEGORY. Se modifican respuestas de PROCESS CATEGORY. --- .../src/BusinessModel/ProcessCategory.php | 11 ++- .../BusinessModel/ProcessCategoryTest.php | 76 +++++++++++++++++++ 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/workflow/engine/src/BusinessModel/ProcessCategory.php b/workflow/engine/src/BusinessModel/ProcessCategory.php index 5ceb1502f..db507532c 100644 --- a/workflow/engine/src/BusinessModel/ProcessCategory.php +++ b/workflow/engine/src/BusinessModel/ProcessCategory.php @@ -261,7 +261,9 @@ class ProcessCategory } //Return if ($oProcessCategory != '') { - return $oProcessCategory; + $oProcessCategory = array_change_key_case($oProcessCategory, CASE_LOWER); + $oResponse = json_decode(json_encode($oProcessCategory), false); + return $oResponse; } else { throw (new \Exception( 'The Category with cat_uid: '.$cat_uid.' doesn\'t exist!')); } @@ -291,7 +293,7 @@ class ProcessCategory $pcat->setCategoryUid( $catUid ); $pcat->setCategoryName( $catName ); $pcat->save(); - $oProcessCategory = array_change_key_case($this->getCategory( $catUid ), CASE_LOWER); + $oProcessCategory = $this->getCategory( $catUid ); //Return return $oProcessCategory; } catch (\Exception $e) { @@ -321,9 +323,10 @@ class ProcessCategory $pcat->setCategoryUid( $catUID ); $pcat->setCategoryName( $catName ); $pcat->save(); - $oProcessCategory = array_change_key_case($this->getCategory( $cat_uid ), CASE_LOWER); + $oProcessCategory = $this->getCategory( $cat_uid ); //Return - return $oProcessCategory; + $oResponse = json_decode(json_encode($oProcessCategory), false); + return $oResponse; } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php b/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php index 1d36f6b2c..b795ce996 100644 --- a/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php +++ b/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php @@ -13,6 +13,20 @@ if (!class_exists("Propel")) { class ProcessCategoryTest extends \PHPUnit_Framework_TestCase { protected static $arrayUid = array(); + protected $oCategory; + + /** + * Set class for test + * + * @coversNothing + * + * @copyright Colosa - Bolivia + */ + public function setUp() + { + $this->oCategory = new \BusinessModel\ProcessCategory(); + } + 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() { try { @@ -46,6 +121,7 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase $this->assertNotEmpty($processCategoryUid); } + public function testGetCategories() { $processCategory = new \BusinessModel\ProcessCategory(); From 20fadab8d971df7cf40592e5f007492678d87594 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Thu, 3 Apr 2014 09:14:39 -0400 Subject: [PATCH 02/15] Se agrega test unit para PROCESS CATEGORY --- .../engine/src/Tests/BusinessModel/ProcessCategoryTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php b/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php index 2bbddc314..f0a1a3e25 100644 --- a/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php +++ b/workflow/engine/src/Tests/BusinessModel/ProcessCategoryTest.php @@ -8,7 +8,7 @@ if (!class_exists("Propel")) { /** * Class ProcessCategoryTest * - * @package Tests\BusinessModel + * @package Tests/ProcessMaker/BusinessModel */ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase { @@ -24,7 +24,7 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->oCategory = new \BusinessModel\ProcessCategory(); + $this->oCategory = new \ProcessMaker\BusinessModel\ProcessCategory(); } From 3e2420bc55daa33e7bfa7c8d112c46be24cb82ca Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 3 Apr 2014 10:22:37 -0400 Subject: [PATCH 03/15] Arreglos en cases actions, case note, case variables y output document --- .../basic_sequence_cases_actions.feature | 32 ++++++----- .../case_note/main_tests_case_note.feature | 3 +- .../main_tests_case_variables.feature | 5 +- .../negative_tests_case_variables.feature | 56 +------------------ ...egative_tests_output_document_case.feature | 9 +++ 5 files changed, 29 insertions(+), 76 deletions(-) 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 bcb72e222..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 @@ -121,7 +121,7 @@ Scenario: Returns a list of the cases for the logged in user (Draft) Then the response status code should be 200 And the response charset is "UTF-8" And the type is "array" - And the response has 17 records + And the response has 18 records Scenario Outline: Reassigns a case to a different user, from user "administrator" to user "aaron" @@ -129,10 +129,10 @@ 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 "cases//reassign-case" with the key "app_uid" stored in session array as variable "app_uid_" + 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" @@ -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,7 +153,7 @@ Scenario: Route a case to the next task in the process "del_index": "1" } """ - And I request "cases//route-case" with the key "app_uid" stored in session array as variable "app_uid_" + 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" @@ -167,14 +167,14 @@ 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" with the key "app_uid" stored in session array as variable "app_uid_" + 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" @@ -187,14 +187,14 @@ 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" with the key "app_uid" stored in session array as variable "app_uid_" + 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" @@ -207,14 +207,14 @@ 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" with the key "app_uid" stored in session array as variable "app_uid_" + 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" @@ -227,14 +227,14 @@ 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/" with the key "app_uid" stored in session array as variable "app_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" @@ -247,19 +247,21 @@ Scenario: Executes a ProcessMaker trigger for a case | Ejecucion de trigger | 5 | 54962158250ec613ba5bc89016850103 | -Scenario: Delete a case +Scenario Outline: Delete a case Given PUT this data: """ { } """ + + And that I want to delete a resource with the key "app_uid" stored in session array as variable "app_uid_" 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 delete a resource with the key "app_uid" stored in session array as variable "app_uid_" + Examples: 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_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/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 From 4db659ff8b0a4e12f741a54ce96003e434619ede Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 3 Apr 2014 10:30:47 -0400 Subject: [PATCH 04/15] Updating phpunit execution task on build.xml for jenkins --- build.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 9377409c4..cfb6cc966 100644 --- a/build.xml +++ b/build.xml @@ -122,7 +122,9 @@ - + + + From 3160985f3335f43ef19f5bebdafde00ba1fb4530 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 3 Apr 2014 10:35:17 -0400 Subject: [PATCH 05/15] Error de sintaxis en case note --- .../case_note/negative_tests_case_note.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 193c090451e298c26043f799c627563419d92020 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 3 Apr 2014 11:09:54 -0400 Subject: [PATCH 06/15] error de sintaxis en output document cases --- .../basic_sequence_output_document_case.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 1847ed4549a2fbce01b30472c67f18f42717074d Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 3 Apr 2014 11:18:57 -0400 Subject: [PATCH 07/15] Updating phpunit execution task on build.xml for jenkins --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index cfb6cc966..4d81eee93 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,7 @@ + depends="prepare,lint,phploc,pdepend,phpcs-ci,phpunit,phpdox,behat"/> From 709db9006283cb309dac3cf11f36aebf5aa43c23 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 3 Apr 2014 11:57:35 -0400 Subject: [PATCH 08/15] Errores de sintaxis en fetures cases actions y process permisssions --- .../main_tests_cases_actions.feature | 18 +++++++++--------- .../basic_sequence_permissions.feature | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) 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/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 /---------------------------------------------------------------------- From a43c1d36c433d6237dff8cdb4e4fad8a7a40ac8c Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 3 Apr 2014 12:06:52 -0400 Subject: [PATCH 09/15] Updating build.xml and phpunit.xml to add and run API unit tests suite --- build.xml | 5 ++++- phpunit.xml | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 4d81eee93..bac41ff99 100644 --- a/build.xml +++ b/build.xml @@ -123,7 +123,10 @@ - + + + + diff --git a/phpunit.xml b/phpunit.xml index d3ed5e4d7..a5de70e63 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,6 +20,9 @@ ./tests/unit/ --> + + ./workflow/engine/src/ +