Merged in cochalo/processmaker (pull request #332)
Phpunit para CASES ACTIONS
This commit is contained in:
@@ -636,12 +636,16 @@ class Cases
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function putCancelCase($app_uid, $usr_uid, $del_index = false) {
|
||||
Validator::appUid($app_uid, '$cas_uid');
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::isString($usr_uid, '$usr_uid');
|
||||
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
Validator::usrUid($usr_uid, '$usr_uid');
|
||||
|
||||
if ($del_index === false) {
|
||||
$del_index = \AppDelegation::getCurrentIndex($app_uid);
|
||||
}
|
||||
Validator::isInteger($del_index, '$del_index');
|
||||
|
||||
$case = new \Cases();
|
||||
$case->cancelCase( $app_uid, $del_index, $usr_uid );
|
||||
@@ -661,15 +665,20 @@ class Cases
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function putPauseCase($app_uid, $usr_uid, $del_index = false, $unpaused_date = null) {
|
||||
Validator::appUid($app_uid, '$cas_uid');
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::isString($usr_uid, '$usr_uid');
|
||||
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
Validator::usrUid($usr_uid, '$usr_uid');
|
||||
if ($unpaused_date != null) {
|
||||
Validator::isDate($unpaused_date, 'Y-m-d', '$unpaused_date');
|
||||
}
|
||||
|
||||
if ($del_index === false) {
|
||||
$del_index = \AppDelegation::getCurrentIndex($app_uid);
|
||||
}
|
||||
Validator::isInteger($del_index, '$del_index');
|
||||
|
||||
if ($unpaused_date != null) {
|
||||
Validator::isDate($unpaused_date, 'Y-m-d', '$unpaused_date');
|
||||
}
|
||||
|
||||
$case = new \Cases();
|
||||
$case->pauseCase( $app_uid, $del_index, $usr_uid, $unpaused_date );
|
||||
@@ -687,12 +696,16 @@ class Cases
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function putUnpauseCase($app_uid, $usr_uid, $del_index = false) {
|
||||
Validator::appUid($app_uid, '$cas_uid');
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::isString($usr_uid, '$usr_uid');
|
||||
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
Validator::usrUid($usr_uid, '$usr_uid');
|
||||
|
||||
if ($del_index === false) {
|
||||
$del_index = \AppDelegation::getCurrentIndex($app_uid);
|
||||
}
|
||||
Validator::isInteger($del_index, '$del_index');
|
||||
|
||||
$case = new \Cases();
|
||||
$case->unpauseCase( $app_uid, $del_index, $usr_uid );
|
||||
@@ -710,13 +723,18 @@ class Cases
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function putExecuteTriggerCase($app_uid, $tri_uid, $usr_uid, $del_index = false) {
|
||||
Validator::appUid($app_uid, '$cas_uid');
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::isString($tri_uid, '$tri_uid');
|
||||
Validator::isString($usr_uid, '$usr_uid');
|
||||
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
Validator::triUid($tri_uid, '$tri_uid');
|
||||
Validator::usrUid($usr_uid, '$usr_uid');
|
||||
|
||||
if ($del_index === false) {
|
||||
$del_index = \AppDelegation::getCurrentIndex($app_uid);
|
||||
}
|
||||
Validator::isInteger($del_index, '$del_index');
|
||||
|
||||
$case = new \wsBase();
|
||||
$case->executeTrigger( $usr_uid, $app_uid, $tri_uid, $del_index );
|
||||
@@ -733,7 +751,8 @@ class Cases
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function deleteCase($app_uid) {
|
||||
Validator::appUid($app_uid, '$cas_uid');
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
$case = new \Cases();
|
||||
$case->removeCase( $app_uid );
|
||||
}
|
||||
|
||||
@@ -263,6 +263,40 @@ class Validator{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate is string
|
||||
* @var array $field. Field type string
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
static public function isString($field, $nameField)
|
||||
{
|
||||
if (!is_string($field)) {
|
||||
throw (new \Exception("Invalid value for '$nameField' it must be a string."));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate is integer
|
||||
* @var array $field. Field type integer
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
static public function isInteger($field, $nameField)
|
||||
{
|
||||
if (!is_integer($field)) {
|
||||
throw (new \Exception("Invalid value for '$nameField' it must be a integer."));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate is boolean
|
||||
* @var boolean $field. Field type boolean
|
||||
|
||||
392
workflow/engine/src/Tests/BusinessModel/CasesActionTest13_17.php
Normal file
392
workflow/engine/src/Tests/BusinessModel/CasesActionTest13_17.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user