resolve conflicts
This commit is contained in:
@@ -1980,6 +1980,12 @@ class AppSolr
|
||||
}
|
||||
else {
|
||||
foreach ($UnSerializedCaseData as $k => $value) {
|
||||
//This validation is only for the 'checkbox' control for the BPMN forms,
|
||||
//the request is not made to the database to obtain the control
|
||||
//associated with the variable so as not to decrease the performance.
|
||||
if (is_array($value) && count($value) === 1 && isset($value[0]) && !is_object($value[0]) && !is_array($value[0])) {
|
||||
$value = $value[0];
|
||||
}
|
||||
if (! is_array ($value) && ! is_object ($value) && $value != '' && $k != 'SYS_LANG' && $k != 'SYS_SKIN' && $k != 'SYS_SYS') {
|
||||
// search the field type in array of dynaform fields
|
||||
if (! empty ($dynaformFieldTypes) && array_key_exists (trim ($k), $dynaformFieldTypes)) {
|
||||
|
||||
@@ -1033,38 +1033,7 @@ class Derivation
|
||||
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
|
||||
break;
|
||||
case TASK_FINISH_TASK:
|
||||
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
||||
$this->case->closeAppThread($currentDelegation['APP_UID'], $iAppThreadIndex);
|
||||
if (isset($nextDel["TAS_UID_DUMMY"])) {
|
||||
$criteria = new Criteria("workflow");
|
||||
$criteria->addSelectColumn(RoutePeer::TAS_UID);
|
||||
$criteria->addJoin(RoutePeer::TAS_UID, AppDelegationPeer::TAS_UID);
|
||||
$criteria->add(RoutePeer::PRO_UID, $appFields['PRO_UID']);
|
||||
$criteria->add(RoutePeer::ROU_NEXT_TASK, isset($nextDel['ROU_PREVIOUS_TASK']) ? $nextDel['ROU_PREVIOUS_TASK'] : '');
|
||||
$criteria->add(RoutePeer::ROU_TYPE, isset($nextDel['ROU_PREVIOUS_TYPE']) ? $nextDel['ROU_PREVIOUS_TYPE'] : '');
|
||||
$criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$rsCriteria = RoutePeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$executeEvent = ($rsCriteria->next()) ? false : true;
|
||||
|
||||
$multiInstanceCompleted = true;
|
||||
if ($flagTaskAssignTypeIsMultipleInstance) {
|
||||
$multiInstanceCompleted = $this->case->multiInstanceIsCompleted(
|
||||
$appFields['APP_UID'],
|
||||
$appFields['TAS_UID'],
|
||||
$appFields['DEL_PREVIOUS']);
|
||||
}
|
||||
|
||||
$taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]);
|
||||
if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())
|
||||
&& $multiInstanceCompleted && $executeEvent
|
||||
) {
|
||||
$this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true);
|
||||
}
|
||||
}
|
||||
$aContext['action'] = 'finish-task';
|
||||
//Logger
|
||||
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
|
||||
$this->finishTask($currentDelegation, $nextDel, $appFields, $flagFirstIteration, $flagTaskAssignTypeIsMultipleInstance, $aContext);
|
||||
break;
|
||||
default:
|
||||
//Get all siblingThreads
|
||||
@@ -1348,7 +1317,7 @@ class Derivation
|
||||
/* Start Block : Count the open threads of $currentDelegation['APP_UID'] */
|
||||
$openThreads = $this->case->GetOpenThreads( $currentDelegation['APP_UID'] );
|
||||
|
||||
$flag = false;
|
||||
$flagUpdateCase = false;
|
||||
|
||||
//check if there is any paused thread
|
||||
|
||||
@@ -1364,18 +1333,24 @@ class Derivation
|
||||
$appFields["APP_STATUS"] = "COMPLETED";
|
||||
$appFields["APP_FINISH_DATE"] = "now";
|
||||
$this->verifyIsCaseChild($currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"]);
|
||||
$flag = true;
|
||||
$flagUpdateCase = true;
|
||||
|
||||
}
|
||||
|
||||
if (isset( $iNewDelIndex )) {
|
||||
//The variable $iNewDelIndex will be true if we created a new index the variable
|
||||
if (isset($iNewDelIndex)) {
|
||||
$appFields["DEL_INDEX"] = $iNewDelIndex;
|
||||
$appFields["TAS_UID"] = $nextDel["TAS_UID"];
|
||||
|
||||
$flag = true;
|
||||
$excludeTasUid = array(TASK_FINISH_PROCESS, TASK_FINISH_TASK);
|
||||
//If the last TAS_UID value is not valid we will check for the valid TAS_UID value
|
||||
if (in_array($nextDel["TAS_UID"], $excludeTasUid) && is_array($arrayDerivationResult) && isset(current($arrayDerivationResult)["TAS_UID"])) {
|
||||
$appFields["TAS_UID"] = current($arrayDerivationResult)["TAS_UID"];
|
||||
} else {
|
||||
$appFields["TAS_UID"] = $nextDel["TAS_UID"];
|
||||
}
|
||||
$flagUpdateCase = true;
|
||||
}
|
||||
|
||||
if ($flag) {
|
||||
if ($flagUpdateCase) {
|
||||
//Start Block : UPDATES APPLICATION
|
||||
$this->case->updateCase( $currentDelegation["APP_UID"], $appFields );
|
||||
//End Block : UPDATES APPLICATION
|
||||
@@ -2009,4 +1984,47 @@ class Derivation
|
||||
\G::log(G::loadTranslation('ID_NOTIFICATION_ERROR') . '|' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param array $currentDelegation
|
||||
* @param array $nextDel
|
||||
* @param array $appFields
|
||||
* @param boolean $flagFirstIteration
|
||||
* @param boolean $flagTaskAssignTypeIsMultipleInstance
|
||||
* @param array $aContext
|
||||
* @return void
|
||||
*/
|
||||
public function finishTask($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $flagTaskAssignTypeIsMultipleInstance = false, $aContext = array()) {
|
||||
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
||||
$this->case->closeAppThread($currentDelegation['APP_UID'], $iAppThreadIndex);
|
||||
if (isset($nextDel["TAS_UID_DUMMY"])) {
|
||||
$criteria = new Criteria("workflow");
|
||||
$criteria->addSelectColumn(RoutePeer::TAS_UID);
|
||||
$criteria->addJoin(RoutePeer::TAS_UID, AppDelegationPeer::TAS_UID);
|
||||
$criteria->add(RoutePeer::PRO_UID, $appFields['PRO_UID']);
|
||||
$criteria->add(RoutePeer::ROU_NEXT_TASK, isset($nextDel['ROU_PREVIOUS_TASK']) ? $nextDel['ROU_PREVIOUS_TASK'] : '');
|
||||
$criteria->add(RoutePeer::ROU_TYPE, isset($nextDel['ROU_PREVIOUS_TYPE']) ? $nextDel['ROU_PREVIOUS_TYPE'] : '');
|
||||
$criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$rsCriteria = RoutePeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$executeEvent = ($rsCriteria->next()) ? false : true;
|
||||
|
||||
$multiInstanceCompleted = true;
|
||||
if ($flagTaskAssignTypeIsMultipleInstance) {
|
||||
$multiInstanceCompleted = $this->case->multiInstanceIsCompleted(
|
||||
$appFields['APP_UID'],
|
||||
$appFields['TAS_UID'],
|
||||
$appFields['DEL_PREVIOUS']);
|
||||
}
|
||||
|
||||
$taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]);
|
||||
if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())
|
||||
&& $multiInstanceCompleted && $executeEvent
|
||||
) {
|
||||
$this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true);
|
||||
}
|
||||
}
|
||||
$aContext['action'] = 'finish-task';
|
||||
//Logger
|
||||
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class pmLicenseManager
|
||||
$this->id = $results ['ID'];
|
||||
$this->expireIn = $this->getExpireIn ();
|
||||
$this->features = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_PLUGIN'])? $results ['DATA']['CUSTOMER_PLUGIN'] : $this->getActiveFeatures() : array();
|
||||
$this->licensedfeatures = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_LICENSED_FEATURES'])? $results ['DATA']['CUSTOMER_LICENSED_FEATURES'] : array() : array();
|
||||
$this->licensedfeatures = $this->result != 'TMINUS' ? (isset($results ['DATA']['CUSTOMER_LICENSED_FEATURES']) && is_array($results ['DATA']['CUSTOMER_LICENSED_FEATURES'])) ? $results ['DATA']['CUSTOMER_LICENSED_FEATURES'] : array() : array();
|
||||
$this->licensedfeaturesList = isset($results ['DATA']['LICENSED_FEATURES_LIST'])? $results ['DATA']['LICENSED_FEATURES_LIST'] : null;
|
||||
$this->status = $this->getCurrentLicenseStatus ();
|
||||
|
||||
|
||||
@@ -1986,7 +1986,7 @@ class wsBase
|
||||
|
||||
$task = TaskPeer::retrieveByPK($taskId);
|
||||
|
||||
$arrayTaskTypeToExclude = array("START-TIMER-EVENT");
|
||||
$arrayTaskTypeToExclude = array("START-TIMER-EVENT", "START-MESSAGE-EVENT");
|
||||
|
||||
if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $founded == "") {
|
||||
$result = new wsResponse( 14, G::LoadTranslation( 'ID_TASK_INVALID_USER_NOT_ASSIGNED_TASK' ) );
|
||||
|
||||
@@ -549,9 +549,17 @@ class ListInbox extends BaseListInbox
|
||||
$criteria->addJoin(ListInboxPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
$sort = (!empty($filters['sort'])) ?
|
||||
ListInboxPeer::TABLE_NAME.'.'.$filters['sort'] :
|
||||
"LIST_INBOX.APP_UPDATE_DATE";
|
||||
//We will be defined the sort
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$sort = $casesList->getSortColumn(
|
||||
__CLASS__ . 'Peer',
|
||||
BasePeer::TYPE_FIELDNAME,
|
||||
empty($filters['sort']) ? "APP_UPDATE_DATE" : $filters['sort'],
|
||||
"APP_UPDATE_DATE",
|
||||
$this->additionalClassName,
|
||||
$additionalColumns
|
||||
);
|
||||
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
|
||||
$start = isset($filters['start']) ? $filters['start'] : "0";
|
||||
$limit = isset($filters['limit']) ? $filters['limit'] : "25";
|
||||
@@ -624,7 +632,6 @@ class ListInbox extends BaseListInbox
|
||||
* Returns the number of cases of a user
|
||||
* @param string $usrUid
|
||||
* @param array $filters
|
||||
* @param string $status
|
||||
* @return int
|
||||
*/
|
||||
public function getCountList($usrUid, $filters = array())
|
||||
|
||||
@@ -364,9 +364,17 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
$sort = (!empty($filters['sort'])) ?
|
||||
ListParticipatedLastPeer::TABLE_NAME.'.'.$filters['sort'] :
|
||||
'DEL_DELEGATE_DATE';
|
||||
//We will be defined the sort
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$sort = $casesList->getSortColumn(
|
||||
__CLASS__ . 'Peer',
|
||||
BasePeer::TYPE_FIELDNAME,
|
||||
empty($filters['sort']) ? "DEL_DELEGATE_DATE" : $filters['sort'],
|
||||
"DEL_DELEGATE_DATE",
|
||||
$this->additionalClassName,
|
||||
$additionalColumns
|
||||
);
|
||||
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : 'ASC';
|
||||
$start = isset($filters['start']) ? $filters['start'] : '0';
|
||||
$limit = isset($filters['limit']) ? $filters['limit'] : '25';
|
||||
|
||||
@@ -307,7 +307,17 @@ class ListPaused extends BaseListPaused
|
||||
$criteria->add(ListPausedPeer::USR_UID, $usr_uid, Criteria::EQUAL);
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
$sort = (!empty($filters['sort'])) ? ListPausedPeer::TABLE_NAME.'.'.$filters['sort'] : "APP_PAUSED_DATE";
|
||||
//We will be defined the sort
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$sort = $casesList->getSortColumn(
|
||||
__CLASS__ . 'Peer',
|
||||
BasePeer::TYPE_FIELDNAME,
|
||||
empty($filters['sort']) ? "APP_PAUSED_DATE" : $filters['sort'],
|
||||
"APP_PAUSED_DATE",
|
||||
$this->additionalClassName,
|
||||
$additionalColumns
|
||||
);
|
||||
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
|
||||
$start = isset($filters['start']) ? $filters['start'] : "0";
|
||||
$limit = isset($filters['limit']) ? $filters['limit'] : "25";
|
||||
|
||||
@@ -301,9 +301,18 @@ class ListUnassigned extends BaseListUnassigned
|
||||
|
||||
//Apply some filters
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
$sort = (!empty($filters['sort'])) ?
|
||||
ListUnassignedPeer::TABLE_NAME.'.'.$filters['sort'] :
|
||||
"LIST_UNASSIGNED.DEL_DELEGATE_DATE";
|
||||
|
||||
//We will be defined the sort
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$sort = $casesList->getSortColumn(
|
||||
__CLASS__ . 'Peer',
|
||||
BasePeer::TYPE_FIELDNAME,
|
||||
empty($filters['sort']) ? "DEL_DELEGATE_DATE" : $filters['sort'],
|
||||
"DEL_DELEGATE_DATE",
|
||||
$this->additionalClassName,
|
||||
$additionalColumns
|
||||
);
|
||||
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
|
||||
$start = isset($filters['start']) ? $filters['start'] : "0";
|
||||
$limit = isset($filters['limit']) ? $filters['limit'] : "25";
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
/**
|
||||
* Home controller
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||
* @inherits Controller
|
||||
* @access public
|
||||
*/
|
||||
|
||||
class Home extends Controller
|
||||
{
|
||||
private $userID;
|
||||
private $userUid;
|
||||
private $userName;
|
||||
private $userFullName;
|
||||
private $userRolName;
|
||||
@@ -24,9 +23,18 @@ class Home extends Controller
|
||||
private $lastSkin;
|
||||
private $usrId;
|
||||
|
||||
/**
|
||||
* Check the if the user has permissions over functions
|
||||
*/
|
||||
public function call ($name)
|
||||
{
|
||||
global $RBAC;
|
||||
$RBAC->allows(basename(__FILE__), $name);
|
||||
parent::call($name);
|
||||
}
|
||||
|
||||
public function __construct ()
|
||||
{
|
||||
//die($_SESSION['user_experience']);
|
||||
// setting client browser information
|
||||
$this->clientBrowser = G::getBrowser();
|
||||
|
||||
@@ -36,13 +44,13 @@ class Home extends Controller
|
||||
$this->userUxBaseTemplate = (is_dir( PATH_CUSTOM_SKINS . 'uxs' )) ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'templates' : 'home';
|
||||
|
||||
if (isset( $_SESSION['USER_LOGGED'] ) && ! empty( $_SESSION['USER_LOGGED'] )) {
|
||||
$this->userID = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : null;
|
||||
$this->userUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : null;
|
||||
$this->userName = isset( $_SESSION['USR_USERNAME'] ) ? $_SESSION['USR_USERNAME'] : '';
|
||||
$this->userFullName = isset( $_SESSION['USR_FULLNAME'] ) ? $_SESSION['USR_FULLNAME'] : '';
|
||||
$this->userRolName = isset( $_SESSION['USR_ROLENAME'] ) ? $_SESSION['USR_ROLENAME'] : '';
|
||||
|
||||
|
||||
$users = new Users();
|
||||
$users = $users->load($this->userID);
|
||||
$users = $users->load($this->userUid);
|
||||
$this->usrId = $users["USR_ID"];
|
||||
}
|
||||
}
|
||||
@@ -59,7 +67,10 @@ class Home extends Controller
|
||||
$skin = $this->clientBrowser['name'] == 'msie' ? $this->lastSkin : 'simplified';
|
||||
|
||||
if (! is_array( $data )) {
|
||||
$data = array ('u' => '','p' => '','m' => ''
|
||||
$data = array (
|
||||
'u' => '',
|
||||
'p' => '',
|
||||
'm' => ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -158,7 +169,7 @@ class Home extends Controller
|
||||
|
||||
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'index' );
|
||||
|
||||
$this->setVar( 'usrUid', $this->userID );
|
||||
$this->setVar( 'usrUid', $this->userUid );
|
||||
$this->setVar( 'userName', $this->userName );
|
||||
$this->setVar( 'processList', $processesList );
|
||||
$this->setVar( 'canStartCase', $case->canStartCase( $_SESSION['USER_LOGGED'] ) );
|
||||
@@ -199,13 +210,13 @@ class Home extends Controller
|
||||
}
|
||||
|
||||
if ($solrEnabled) {
|
||||
$cases = $ApplicationSolrIndex->getAppGridData($this->userID, 0, 1, 'todo');
|
||||
$cases = $ApplicationSolrIndex->getAppGridData($this->userUid, 0, 1, 'todo');
|
||||
} else {
|
||||
G::LoadClass( 'applications' );
|
||||
|
||||
$apps = new Applications();
|
||||
|
||||
$cases = $apps->getAll( $this->userID, 0, 1, 'todo' );
|
||||
$cases = $apps->getAll( $this->userUid, 0, 1, 'todo' );
|
||||
}
|
||||
|
||||
if (! isset( $cases['data'][0] )) {
|
||||
@@ -229,7 +240,7 @@ class Home extends Controller
|
||||
|
||||
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'indexSingle' );
|
||||
|
||||
$this->setVar( 'usrUid', $this->userID );
|
||||
$this->setVar( 'usrUid', $this->userUid );
|
||||
$this->setVar( 'userName', $this->userName );
|
||||
$this->setVar( 'steps', $steps );
|
||||
$this->setVar( 'default_url', "cases/cases_Open?APP_UID={$lastApp['APP_UID']}&DEL_INDEX={$lastApp['DEL_INDEX']}&action=todo" );
|
||||
@@ -300,14 +311,27 @@ class Home extends Controller
|
||||
$userObject = Users::loadById($user);
|
||||
$userName = $userObject->getUsrLastname() . " " . $userObject->getUsrFirstname();
|
||||
}
|
||||
|
||||
$cases = $this->getAppsData( $httpData->t, null, null, $user, null, $search, $process, $status, $dateFrom, $dateTo, null, null, 'APP_CACHE_VIEW.APP_NUMBER', $category);
|
||||
|
||||
$cases = $this->getAppsData(
|
||||
$httpData->t,
|
||||
null,
|
||||
null,
|
||||
$user,
|
||||
null,
|
||||
$search,
|
||||
$process,
|
||||
$status,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
null,
|
||||
null,
|
||||
'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$category
|
||||
);
|
||||
$arraySearch = array($process, $status, $search, $category, $user, $dateFrom, $dateTo );
|
||||
|
||||
// settings vars and rendering
|
||||
$processes = array();
|
||||
$processes = $this->getProcessArray($httpData->t, $this->userID );
|
||||
$this->setVar( 'statusValues', $this->getStatusArray( $httpData->t, $this->userID ) );
|
||||
$this->setVar( 'statusValues', $this->getStatusArray( $httpData->t, $this->userUid) );
|
||||
$this->setVar( 'categoryValues', $this->getCategoryArray() );
|
||||
$this->setVar( 'allUsersValues', $this->getAllUsersArray( 'search' ) );
|
||||
$this->setVar( 'categoryTitle', G::LoadTranslation("ID_CATEGORY") );
|
||||
@@ -377,10 +401,14 @@ class Home extends Controller
|
||||
$user = null;
|
||||
break;
|
||||
case null:
|
||||
$user = $this->usrId;
|
||||
if ($type === 'search') {
|
||||
$user = null;
|
||||
} else {
|
||||
$user = $this->usrId;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//$user = $this->userID;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -429,6 +457,7 @@ class Home extends Controller
|
||||
);
|
||||
} else {
|
||||
$dataList['userId'] = $user;
|
||||
$dataList['userUid'] = $this->userUid;
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['filter'] = $filter;
|
||||
@@ -442,17 +471,34 @@ class Home extends Controller
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['category'] = $category;
|
||||
$dataList['action'] = $type;
|
||||
$dataList['dir'] = 'DESC';
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (true) {
|
||||
//In enterprise version this block of code should always be executed
|
||||
//In community version this block of code is deleted and is executed the other
|
||||
$swType = $type === "todo" || $type === "draft";
|
||||
if ($swType || $type === "unassigned") {
|
||||
//The change is made because the method 'getList()' does not
|
||||
$listType = '';
|
||||
if (!empty($type)) {
|
||||
switch ($type) {
|
||||
case 'todo':
|
||||
$listType = 'inbox';
|
||||
break;
|
||||
case 'draft':
|
||||
$listType = 'inbox';
|
||||
break;
|
||||
case 'unassigned':
|
||||
$listType = 'unassigned';
|
||||
break;
|
||||
case 'search':
|
||||
$dataList['filterStatus'] = $status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($listType)) {
|
||||
//The change is made because the method 'getList()' does not
|
||||
//support 'USR_UID', this method uses the numeric field 'USR_ID'.
|
||||
$userObject = Users::loadById($dataList['userId']);
|
||||
$dataList['userId'] = $userObject->getUsrUid();
|
||||
$listType = $swType ? "inbox" : $type;
|
||||
$list = new \ProcessMaker\BusinessModel\Lists();
|
||||
$cases = $list->getList($listType, $dataList);
|
||||
}
|
||||
@@ -471,7 +517,7 @@ class Home extends Controller
|
||||
|
||||
if(empty($cases) && $type == 'search') {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = $case->getList($dataList);
|
||||
$cases = $case->getCasesSearch($dataList);
|
||||
foreach ($cases['data'] as &$value) {
|
||||
$value = array_change_key_case($value, CASE_UPPER);
|
||||
}
|
||||
@@ -532,7 +578,6 @@ class Home extends Controller
|
||||
|
||||
$oCase = new Cases();
|
||||
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
//../cases/cases_Open?APP_UID={$APP.APP_UID}&DEL_INDEX={$APP.DEL_INDEX}&action=todo
|
||||
$aNextStep['PAGE'] = '../cases/cases_Open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft';
|
||||
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
|
||||
|
||||
@@ -557,8 +602,10 @@ class Home extends Controller
|
||||
|
||||
function getUserArray($action, $userUid, $search = null)
|
||||
{
|
||||
global $oAppCache;
|
||||
$status = array();
|
||||
G::LoadClass("configuration");
|
||||
$conf = new Configurations();
|
||||
$confEnvSetting = $conf->getFormats();
|
||||
$users = array();
|
||||
$users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER"));
|
||||
$users[] = array("ALL", G::LoadTranslation("ID_ALL_USERS"));
|
||||
|
||||
@@ -571,16 +618,25 @@ class Home extends Controller
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_UID);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_ID);
|
||||
if (!empty($search)) {
|
||||
$cUsers->addOr(UsersPeer::USR_FIRSTNAME, "%$search%", Criteria::LIKE);
|
||||
$cUsers->addOr(UsersPeer::USR_LASTNAME, "%$search%", Criteria::LIKE);
|
||||
$cUsers->add(
|
||||
$cUsers->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $search . '%', Criteria::LIKE)->addOr(
|
||||
$cUsers->getNewCriterion(UsersPeer::USR_LASTNAME, '%' . $search . '%', Criteria::LIKE))
|
||||
);
|
||||
}
|
||||
$oDataset = UsersPeer::doSelectRS($cUsers);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$users[] = array($aRow['USR_ID'], htmlentities($aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME'], ENT_QUOTES, "UTF-8"));
|
||||
$usrFullName = $conf->usersNameFormatBySetParameters(
|
||||
$confEnvSetting["format"],
|
||||
$aRow["USR_USERNAME"],
|
||||
$aRow["USR_FIRSTNAME"],
|
||||
$aRow["USR_LASTNAME"]
|
||||
);
|
||||
$users[] = array($aRow['USR_ID'], htmlentities($usrFullName, ENT_QUOTES, "UTF-8"));
|
||||
$oDataset->next();
|
||||
}
|
||||
break;
|
||||
@@ -593,10 +649,9 @@ class Home extends Controller
|
||||
|
||||
function getCategoryArray ()
|
||||
{
|
||||
global $oAppCache;
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$category[] = array ("",G::LoadTranslation( "ID_ALL_CATEGORIES" )
|
||||
);
|
||||
$category = array();
|
||||
$category[] = array ("",G::LoadTranslation( "ID_ALL_CATEGORIES" ));
|
||||
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_UID );
|
||||
@@ -615,11 +670,9 @@ class Home extends Controller
|
||||
function getAllUsersArray ($action)
|
||||
{
|
||||
global $oAppCache;
|
||||
$status = array ();
|
||||
$users[] = array ("CURRENT_USER",G::LoadTranslation( "ID_CURRENT_USER" )
|
||||
);
|
||||
$users[] = array ("",G::LoadTranslation( "ID_ALL_USERS" )
|
||||
);
|
||||
$users = array ();
|
||||
$users[] = array ("CURRENT_USER",G::LoadTranslation( "ID_CURRENT_USER" ));
|
||||
$users[] = array ("",G::LoadTranslation( "ID_ALL_USERS" ));
|
||||
|
||||
if ($action == 'to_reassign') {
|
||||
//now get users, just for the Search action
|
||||
@@ -644,66 +697,14 @@ class Home extends Controller
|
||||
|
||||
function getStatusArray ($action, $userUid)
|
||||
{
|
||||
global $oAppCache;
|
||||
$status = array ();
|
||||
$status[] = array ('',G::LoadTranslation( 'ID_ALL_STATUS' ));
|
||||
//get the list based in the action provided
|
||||
switch ($action) {
|
||||
case 'sent':
|
||||
$cStatus = $oAppCache->getSentListProcessCriteria( $userUid ); // a little slow
|
||||
break;
|
||||
case 'simple_search':
|
||||
case 'search':
|
||||
$cStatus = new Criteria( 'workflow' );
|
||||
$cStatus->clearSelectColumns();
|
||||
$cStatus->setDistinct();
|
||||
$cStatus->addSelectColumn( ApplicationPeer::APP_STATUS );
|
||||
$oDataset = ApplicationPeer::doSelectRS( $cStatus );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$status[] = array ($aRow['APP_STATUS'],G::LoadTranslation( 'ID_CASES_STATUS_' . $aRow['APP_STATUS'] )
|
||||
); //here we can have a translation for the status ( the second param)
|
||||
$oDataset->next();
|
||||
}
|
||||
return $status;
|
||||
break;
|
||||
case 'selfservice':
|
||||
$cStatus = $oAppCache->getUnassignedListCriteria( $userUid );
|
||||
break;
|
||||
case 'paused':
|
||||
$cStatus = $oAppCache->getPausedListCriteria( $userUid );
|
||||
break;
|
||||
case 'to_revise':
|
||||
$cStatus = $oAppCache->getToReviseListCriteria( $userUid );
|
||||
// $cStatus = $oAppCache->getPausedListCriteria($userUid);
|
||||
break;
|
||||
case 'to_reassign':
|
||||
$cStatus = $oAppCache->getToReassignListCriteria($userUid);
|
||||
break;
|
||||
case 'todo':
|
||||
case 'draft':
|
||||
case 'gral':
|
||||
// case 'to_revise' :
|
||||
default:
|
||||
return $status;
|
||||
break;
|
||||
}
|
||||
|
||||
//get the status for this user in this action only for participated, unassigned, paused
|
||||
// if ( $action != 'todo' && $action != 'draft' && $action != 'to_revise') {
|
||||
if ($action != 'todo' && $action != 'draft') {
|
||||
//$cStatus = new Criteria('workflow');
|
||||
$cStatus->clearSelectColumns();
|
||||
$cStatus->setDistinct();
|
||||
$cStatus->addSelectColumn( AppCacheViewPeer::APP_STATUS );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $cStatus );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$status[] = array ($aRow['APP_STATUS'],G::LoadTranslation( 'ID_CASES_STATUS_' . $aRow['APP_STATUS'] ));
|
||||
//here we can have a translation for the status ( the second param)
|
||||
$oDataset->next();
|
||||
$status = array();
|
||||
$aStatus = Application::$app_status_values;
|
||||
$status[] = array('', G::LoadTranslation('ID_ALL_STATUS'));
|
||||
foreach ($aStatus as $key => $value) {
|
||||
if ($action == 'search') {
|
||||
$status[] = array ($value, G::LoadTranslation( 'ID_CASES_STATUS_' . $key ));
|
||||
} else {
|
||||
$status[] = array ($key, G::LoadTranslation( 'ID_CASES_STATUS_' . $key ));
|
||||
}
|
||||
}
|
||||
return $status;
|
||||
@@ -711,7 +712,7 @@ class Home extends Controller
|
||||
|
||||
/**
|
||||
* Get the list of active processes
|
||||
*
|
||||
*
|
||||
* @global type $oAppCache
|
||||
* @param type $action
|
||||
* @param type $userUid
|
||||
@@ -719,8 +720,6 @@ class Home extends Controller
|
||||
*/
|
||||
private function getProcessArray($action, $userUid, $search=null)
|
||||
{
|
||||
global $oAppCache;
|
||||
|
||||
$processes = array();
|
||||
$processes[] = array("", G::LoadTranslation("ID_ALL_PROCESS"));
|
||||
|
||||
@@ -733,9 +732,7 @@ class Home extends Controller
|
||||
$cProcess->add(ProcessPeer::PRO_TITLE, "%$search%", Criteria::LIKE);
|
||||
}
|
||||
$oDataset = ProcessPeer::doSelectRS($cProcess);
|
||||
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$processes[] = array($aRow["PRO_ID"], $aRow["PRO_TITLE"]);
|
||||
|
||||
@@ -506,7 +506,12 @@ class pmTablesProxy extends HttpProxyController
|
||||
$j = 0;
|
||||
foreach ($aAdditionalTables['FIELDS'] as $aField) {
|
||||
$conData++;
|
||||
$temp = (array_key_exists($j, $aAux))? '"' . addslashes(stripslashes(utf8_encode($aAux[$j]))) . '"' : '""';
|
||||
|
||||
if (array_key_exists($j, $aAux)) {
|
||||
$temp = '"' . addslashes(stripslashes(G::is_utf8($aAux[$j]) ? $aAux[$j] : utf8_encode($aAux[$j]))) . '"';
|
||||
} else {
|
||||
$temp = '""';
|
||||
}
|
||||
|
||||
if ($temp == '') {
|
||||
switch ($aField['FLD_TYPE']) {
|
||||
|
||||
@@ -109,12 +109,14 @@ if( isset($_GET['action']) && ($_GET['action'] == 'jump') ) {
|
||||
}
|
||||
|
||||
if(isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise') ){
|
||||
$oApp = new Application;
|
||||
$oApp->Load($appUid);
|
||||
//If the case is completed can not update the information from supervisor/review
|
||||
if($oApp->getAppStatus() === 'COMPLETED') {
|
||||
$oSupervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$caseCanBeReview = $oSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex);
|
||||
//Check if the case has the correct status for update the information from supervisor/review
|
||||
if (!$caseCanBeReview) {
|
||||
//The supervisor can not edit the information
|
||||
$script = 'cases_Open?';
|
||||
} else {
|
||||
//The supervisor can edit the information, the case are in TO_DO
|
||||
$script = 'cases_OpenToRevise?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex . '&TAS_UID=' . $tasUid;
|
||||
$oHeadPublisher->assign( 'treeToReviseTitle', G::loadtranslation( 'ID_STEP_LIST' ) );
|
||||
$casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex;
|
||||
|
||||
@@ -10,6 +10,7 @@ if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
|
||||
try {
|
||||
$userUid = $_SESSION['USER_LOGGED'];
|
||||
|
||||
$filters['paged'] = isset($_REQUEST["paged"]) ? $_REQUEST["paged"] : true;
|
||||
$filters['count'] = isset($_REQUEST['count']) ? $_REQUEST["count"] : true;
|
||||
$filters['category'] = isset($_REQUEST["category"]) ? $_REQUEST["category"] : "";
|
||||
@@ -26,6 +27,7 @@ try {
|
||||
$filters['user'] = isset($_REQUEST["user"]) ? $_REQUEST["user"] : "";
|
||||
$listName = isset($_REQUEST["list"]) ? $_REQUEST["list"] : "inbox";
|
||||
$filters['filterStatus'] = isset($_REQUEST["filterStatus"]) ? $_REQUEST["filterStatus"] : "";
|
||||
$filters['sort'] = G::toUpper($filters['sort']);
|
||||
$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '') ? $_REQUEST['openApplicationUid'] : null;
|
||||
|
||||
//Define user when is reassign
|
||||
@@ -99,16 +101,26 @@ try {
|
||||
} else {
|
||||
$filters['limit'] = (int)$filters['limit'];
|
||||
}
|
||||
|
||||
$filters['sort'] = G::toUpper($filters['sort']);
|
||||
$columnsList = $listpeer::getFieldNames(BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
if (!(in_array($filters['sort'], $columnsList))) {
|
||||
if ($filters['sort'] == 'APP_CURRENT_USER' && ($listName == 'participated' || $listName == 'participated_last')) {
|
||||
|
||||
switch ($filters['sort']) {
|
||||
case 'APP_CURRENT_USER':
|
||||
$filters['sort'] = 'DEL_CURRENT_USR_LASTNAME';
|
||||
} else {
|
||||
$filters['sort'] = '';
|
||||
}
|
||||
break;
|
||||
case 'DEL_TASK_DUE_DATE':
|
||||
$filters['sort'] = 'DEL_DUE_DATE';
|
||||
break;
|
||||
case 'APP_UPDATE_DATE':
|
||||
$filters['sort'] = 'DEL_DELEGATE_DATE';
|
||||
break;
|
||||
case 'APP_DEL_PREVIOUS_USER':
|
||||
$filters['sort'] = 'DEL_DUE_DATE';
|
||||
break;
|
||||
case 'DEL_CURRENT_TAS_TITLE':
|
||||
$filters['sort'] = 'APP_TAS_TITLE';
|
||||
break;
|
||||
case 'APP_STATUS_LABEL':
|
||||
$filters['sort'] = 'APP_STATUS';
|
||||
break;
|
||||
}
|
||||
|
||||
$filters['dir'] = G::toUpper($filters['dir']);
|
||||
|
||||
@@ -427,19 +427,12 @@ try {
|
||||
setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
|
||||
}
|
||||
|
||||
$oHeadPublisher = &headPublisher::getSingleton();
|
||||
$oHeadPublisher->extJsInit = true;
|
||||
|
||||
$oHeadPublisher->addExtJsScript('login/init', false); //adding a javascript file .js
|
||||
$oHeadPublisher->assign('uriReq', $sLocation);
|
||||
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
if ($oPluginRegistry->existsTrigger ( PM_AFTER_LOGIN )) {
|
||||
$oPluginRegistry->executeTriggers ( PM_AFTER_LOGIN , $_SESSION['USER_LOGGED'] );
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
//G::header('Location: ' . $sLocation);
|
||||
G::header('Location: ' . $sLocation);
|
||||
die;
|
||||
} catch ( Exception $e ) {
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
|
||||
@@ -214,14 +214,17 @@ class Cases
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list for Cases
|
||||
* Get list of cases from: todo, draft, unassigned
|
||||
* Get list of cases for the following REST endpoints:
|
||||
* /light/todo
|
||||
* /light/draft
|
||||
* /light/participated
|
||||
* /light/paused
|
||||
* /light/unassigned
|
||||
*
|
||||
* @access public
|
||||
* @param array $dataList, Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array $response
|
||||
*/
|
||||
public function getList($dataList = array())
|
||||
{
|
||||
@@ -230,8 +233,8 @@ class Cases
|
||||
$dataList["userId"] = null;
|
||||
}
|
||||
|
||||
$solrEnabled = false;
|
||||
$userUid = $dataList["userId"];
|
||||
//We need to use the USR_UID for the cases in the list
|
||||
$userUid = isset($dataList["userUid"]) ? $dataList["userUid"] : $dataList["userId"];
|
||||
$callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001";
|
||||
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
|
||||
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APPLICATION.APP_NUMBER";
|
||||
@@ -244,7 +247,6 @@ class Cases
|
||||
$process = isset( $dataList["process"] ) ? $dataList["process"] : "";
|
||||
$category = isset( $dataList["category"] ) ? $dataList["category"] : "";
|
||||
$status = isset( $dataList["status"] ) ? strtoupper( $dataList["status"] ) : "";
|
||||
$user = isset( $dataList["user"] ) ? $dataList["user"] : "";
|
||||
$search = isset( $dataList["search"] ) ? $dataList["search"] : "";
|
||||
$action = isset( $dataList["action"] ) ? $dataList["action"] : "todo";
|
||||
$paged = isset( $dataList["paged"] ) ? $dataList["paged"] : true;
|
||||
@@ -253,12 +255,84 @@ class Cases
|
||||
$dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
|
||||
$newerThan = (!empty($dataList['newerThan']))? $dataList['newerThan'] : '';
|
||||
$oldestThan = (!empty($dataList['oldestthan']))? $dataList['oldestthan'] : '';
|
||||
$first = isset( $dataList["first"] ) ? true :false;
|
||||
|
||||
$apps = new \Applications();
|
||||
$response = $apps->getAll(
|
||||
$userUid,
|
||||
$start,
|
||||
$limit,
|
||||
$action,
|
||||
$filter,
|
||||
$search,
|
||||
$process,
|
||||
$status,
|
||||
$type,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$callback,
|
||||
$dir,
|
||||
(strpos($sort, ".") !== false)? $sort : "APP_CACHE_VIEW." . $sort,
|
||||
$category,
|
||||
true,
|
||||
$paged,
|
||||
$newerThan,
|
||||
$oldestThan
|
||||
);
|
||||
if (!empty($response['data'])) {
|
||||
foreach ($response['data'] as &$value) {
|
||||
$value = array_change_key_case($value, CASE_LOWER);
|
||||
}
|
||||
}
|
||||
|
||||
if ($paged) {
|
||||
$response['total'] = $response['totalCount'];
|
||||
$response['start'] = $start+1;
|
||||
$response['limit'] = $limit;
|
||||
$response['sort'] = G::toLower($sort);
|
||||
$response['dir'] = G::toLower($dir);
|
||||
$response['cat_uid'] = $category;
|
||||
$response['pro_uid'] = $process;
|
||||
$response['search'] = $search;
|
||||
} else {
|
||||
$response = $response['data'];
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
/**
|
||||
* Search cases and get list of cases
|
||||
*
|
||||
* @access public
|
||||
* @param array $dataList, Data for list
|
||||
* @return array $response
|
||||
*/
|
||||
public function getCasesSearch($dataList = array())
|
||||
{
|
||||
Validator::isArray($dataList, '$dataList');
|
||||
if (!isset($dataList["userId"])) {
|
||||
$dataList["userId"] = null;
|
||||
}
|
||||
|
||||
//We need to user the USR_ID for performance
|
||||
$userId = $dataList["userId"];
|
||||
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
|
||||
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APPLICATION.APP_NUMBER";
|
||||
if ($sort === 'APP_CACHE_VIEW.APP_NUMBER') {
|
||||
$sort = "APPLICATION.APP_NUMBER";
|
||||
}
|
||||
$start = isset( $dataList["start"] ) ? $dataList["start"] : "0";
|
||||
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "";
|
||||
$process = isset( $dataList["process"] ) ? $dataList["process"] : "";
|
||||
$category = isset( $dataList["category"] ) ? $dataList["category"] : "";
|
||||
$status = isset( $dataList["status"] ) ? strtoupper( $dataList["status"] ) : "";
|
||||
$user = isset( $dataList["user"] ) ? $dataList["user"] : "";
|
||||
$search = isset( $dataList["search"] ) ? $dataList["search"] : "";
|
||||
$dateFrom = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
|
||||
$dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
|
||||
$filterStatus = isset( $dataList["filterStatus"] ) ? strtoupper( $dataList["filterStatus"] ) : "";
|
||||
|
||||
$apps = new \Applications();
|
||||
$response = $apps->searchAll(
|
||||
$userUid,
|
||||
$userId,
|
||||
$start,
|
||||
$limit,
|
||||
$search,
|
||||
@@ -272,19 +346,18 @@ class Cases
|
||||
);
|
||||
|
||||
$response['total'] = 0;
|
||||
$response['start'] = $start + 1;
|
||||
$response['start'] = $start+1;
|
||||
$response['limit'] = $limit;
|
||||
$response['sort'] = G::toLower($sort);
|
||||
$response['dir'] = G::toLower($dir);
|
||||
$response['cat_uid'] = $category;
|
||||
$response['pro_uid'] = $process;
|
||||
$response['search'] = $search;
|
||||
if ($action == 'search') {
|
||||
$response['app_status'] = G::toLower($status);
|
||||
$response['usr_uid'] = $user;
|
||||
$response['date_from'] = $dateFrom;
|
||||
$response['date_to'] = $dateTo;
|
||||
}
|
||||
$response['app_status'] = G::toLower($status);
|
||||
$response['usr_uid'] = $user;
|
||||
$response['date_from'] = $dateFrom;
|
||||
$response['date_to'] = $dateTo;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -3329,4 +3402,42 @@ class Cases
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get the table.column by order by the result
|
||||
* We can include the additional table related to the custom cases list
|
||||
*
|
||||
* @param string $listPeer, name of the list class
|
||||
* @param string $field, name of the fieldName
|
||||
* @param string $sort, name of column by sort
|
||||
* @param string $defaultSort, name of column by sort default
|
||||
* @param string $additionalClassName, name of the className of pmTable
|
||||
* @param array $additionalColumns, columns related to the custom cases list with the format TABLE_NAME.COLUMN_NAME
|
||||
* @return string $tableName
|
||||
*/
|
||||
public function getSortColumn($listPeer, $field, $sort, $defaultSort, $additionalClassName = '', $additionalColumns = array())
|
||||
{
|
||||
$columnSort = $defaultSort;
|
||||
$tableName = '';
|
||||
|
||||
//We will check if the column by sort is a LIST table
|
||||
$columnsList = $listPeer::getFieldNames($field);
|
||||
if (in_array($sort, $columnsList)) {
|
||||
$columnSort = $listPeer::TABLE_NAME . '.' . $sort;
|
||||
} else {
|
||||
//We will sort by CUSTOM CASE LIST table
|
||||
if (count($additionalColumns) > 0) {
|
||||
require_once(PATH_DATA_SITE . 'classes' . PATH_SEP . $additionalClassName . '.php');
|
||||
$aTable = explode('.', current($additionalColumns));
|
||||
if (count($aTable) > 0) {
|
||||
$tableName = $aTable[0];
|
||||
}
|
||||
}
|
||||
if (in_array($tableName . '.' . $sort, $additionalColumns)) {
|
||||
$columnSort = $tableName . '.' . $sort;
|
||||
}
|
||||
}
|
||||
|
||||
return $columnSort;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1494,4 +1494,36 @@ class ProcessSupervisor
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function define if the supervisor can be review and edit
|
||||
* The appStatus can be:TO_DO, DRAFT, COMPLETED, CANCELLED
|
||||
* The thread status can be: PAUSED
|
||||
* @param string $appUid
|
||||
* @param integer $delIndex
|
||||
* @return array
|
||||
*/
|
||||
public function reviewCaseStatusForSupervisor($appUid, $delIndex = 0)
|
||||
{
|
||||
$oApp = new \Application();
|
||||
$oApp->Load($appUid);
|
||||
$canEdit = false;
|
||||
switch ($oApp->getAppStatus()) {
|
||||
case 'TO_DO':
|
||||
//Verify if the case is paused because the supervisor can not edit the PAUSED case
|
||||
$oDelay = new \AppDelay();
|
||||
if ($oDelay->isPaused($appUid, $delIndex)) {
|
||||
$canEdit = false;
|
||||
} else {
|
||||
$canEdit = true;
|
||||
}
|
||||
break;
|
||||
case 'COMPLETED':
|
||||
case 'CANCELLED':
|
||||
default:
|
||||
$canEdit = false;
|
||||
}
|
||||
|
||||
return $canEdit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -844,18 +844,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
"TAS_POSY" => $taskPosY
|
||||
));
|
||||
|
||||
if ($elementType == "bpmnEvent" &&
|
||||
in_array($key, array("end-message-event", "start-message-event", "intermediate-catch-message-event"))
|
||||
) {
|
||||
if (in_array($key, array("start-message-event", "intermediate-catch-message-event"))) {
|
||||
//Task - User
|
||||
//Assign to admin
|
||||
$task = new \Tasks();
|
||||
|
||||
$result = $task->assignUser($taskUid, "00000000000000000000000000000001", 1);
|
||||
}
|
||||
}
|
||||
|
||||
//Element-Task-Relation - Create
|
||||
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
|
||||
|
||||
|
||||
@@ -1,403 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class CalendarTest
|
||||
*
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class CalendarTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $calendar;
|
||||
protected static $numCalendar = 2;
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$calendar = new \ProcessMaker\BusinessModel\Calendar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create calendars
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::create
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$arrayRecord = array();
|
||||
|
||||
//Create
|
||||
for ($i = 0; $i <= self::$numCalendar - 1; $i++) {
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "PHPUnit Calendar$i",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(1, 2, 3, 4, 5),
|
||||
"CAL_WORK_HOUR" => array(
|
||||
array("DAY" => 0, "HOUR_START" => "00:00", "HOUR_END" => "00:00"),
|
||||
array("DAY" => 1, "HOUR_START" => "09:00", "HOUR_END" => "17:00")
|
||||
),
|
||||
"CAL_HOLIDAY" => array(
|
||||
array("NAME" => "holiday1", "DATE_START" => "2014-03-01", "DATE_END" => "2014-03-31"),
|
||||
array("NAME" => "holiday2", "DATE_START" => "2014-03-01", "DATE_END" => "2014-03-31")
|
||||
)
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
|
||||
$this->assertTrue(is_array($arrayCalendar));
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$this->assertTrue(isset($arrayCalendar["CAL_UID"]));
|
||||
|
||||
$arrayRecord[] = $arrayCalendar;
|
||||
}
|
||||
|
||||
//Create - Japanese characters
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "私の名前(PHPUnitの)",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(1, 2, 3, 4, 5)
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
|
||||
$this->assertTrue(is_array($arrayCalendar));
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$this->assertTrue(isset($arrayCalendar["CAL_UID"]));
|
||||
|
||||
$arrayRecord[] = $arrayCalendar;
|
||||
|
||||
//Return
|
||||
return $arrayRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update calendars
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the calendars
|
||||
*/
|
||||
public function testUpdate($arrayRecord)
|
||||
{
|
||||
$arrayData = array("CAL_DESCRIPTION" => "Description...");
|
||||
|
||||
$arrayCalendar = self::$calendar->update($arrayRecord[1]["CAL_UID"], $arrayData);
|
||||
|
||||
$arrayCalendar = self::$calendar->getCalendar($arrayRecord[1]["CAL_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayCalendar));
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$this->assertEquals($arrayCalendar["CAL_DESCRIPTION"], $arrayData["CAL_DESCRIPTION"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get calendars
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::getCalendars
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the calendars
|
||||
*/
|
||||
public function testGetCalendars($arrayRecord)
|
||||
{
|
||||
$arrayCalendar = self::$calendar->getCalendars();
|
||||
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$arrayCalendar = self::$calendar->getCalendars(null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayCalendar);
|
||||
|
||||
$arrayCalendar = self::$calendar->getCalendars(array("filter" => "PHPUnit"));
|
||||
|
||||
$this->assertTrue(is_array($arrayCalendar));
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$this->assertEquals($arrayCalendar[0]["CAL_UID"], $arrayRecord[0]["CAL_UID"]);
|
||||
$this->assertEquals($arrayCalendar[0]["CAL_NAME"], $arrayRecord[0]["CAL_NAME"]);
|
||||
$this->assertEquals($arrayCalendar[0]["CAL_DESCRIPTION"], $arrayRecord[0]["CAL_DESCRIPTION"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get calendar
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::getCalendar
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the calendars
|
||||
*/
|
||||
public function testGetCalendar($arrayRecord)
|
||||
{
|
||||
//Get
|
||||
$arrayCalendar = self::$calendar->getCalendar($arrayRecord[0]["CAL_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayCalendar));
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$this->assertEquals($arrayCalendar["CAL_UID"], $arrayRecord[0]["CAL_UID"]);
|
||||
$this->assertEquals($arrayCalendar["CAL_NAME"], $arrayRecord[0]["CAL_NAME"]);
|
||||
$this->assertEquals($arrayCalendar["CAL_DESCRIPTION"], $arrayRecord[0]["CAL_DESCRIPTION"]);
|
||||
|
||||
//Get - Japanese characters
|
||||
$arrayCalendar = self::$calendar->getCalendar($arrayRecord[self::$numCalendar]["CAL_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayCalendar));
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$this->assertEquals($arrayCalendar["CAL_UID"], $arrayRecord[self::$numCalendar]["CAL_UID"]);
|
||||
$this->assertEquals($arrayCalendar["CAL_NAME"], "私の名前(PHPUnitの)");
|
||||
$this->assertEquals($arrayCalendar["CAL_DESCRIPTION"], "Description");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception when data not is array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", this value must be an array.
|
||||
*/
|
||||
public function testCreateExceptionNoIsArrayData()
|
||||
{
|
||||
$arrayData = 0;
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for required data (CAL_NAME)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Undefined value for "CAL_NAME", it is required.
|
||||
*/
|
||||
public function testCreateExceptionRequiredDataCalName()
|
||||
{
|
||||
$arrayData = array(
|
||||
//"CAL_NAME" => "PHPUnit Calendar",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(1, 2, 3, 4, 5)
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (CAL_NAME)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "CAL_NAME", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionInvalidDataCalName()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(1, 2, 3, 4, 5)
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (CAL_WORK_DAYS)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "CAL_WORK_DAYS", it only accepts values: "1|2|3|4|5|6|7".
|
||||
*/
|
||||
public function testCreateExceptionInvalidDataCalWorkDays()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "PHPUnit Calendar",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(10, 2, 3, 4, 5)
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for calendar name existing
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The calendar name with CAL_NAME: "PHPUnit Calendar0" already exists.
|
||||
*/
|
||||
public function testCreateExceptionExistsCalName()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "PHPUnit Calendar0",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(1, 2, 3, 4, 5),
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception when data not is array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::update
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", this value must be an array.
|
||||
*/
|
||||
public function testUpdateExceptionNoIsArrayData()
|
||||
{
|
||||
$arrayData = 0;
|
||||
|
||||
$arrayCalendar = self::$calendar->update("", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::update
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testUpdateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayCalendar = self::$calendar->update("", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid calendar UID
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::update
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The calendar with CAL_UID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx does not exist.
|
||||
*/
|
||||
public function testUpdateExceptionInvalidCalUid()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "PHPUnit Calendar",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(1, 2, 3, 4, 5),
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->update("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (CAL_NAME)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the calendars
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "CAL_NAME", it can not be empty.
|
||||
*/
|
||||
public function testUpdateExceptionInvalidDataCalName($arrayRecord)
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(1, 2, 3, 4, 5),
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->update($arrayRecord[0]["CAL_UID"], $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (CAL_WORK_DAYS)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the calendars
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "CAL_WORK_DAYS", it only accepts values: "1|2|3|4|5|6|7".
|
||||
*/
|
||||
public function testUpdateExceptionInvalidDataCalWorkDays($arrayRecord)
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAL_NAME" => "PHPUnit Calendar",
|
||||
"CAL_DESCRIPTION" => "Description",
|
||||
"CAL_WORK_DAYS" => array(10, 2, 3, 4, 5),
|
||||
);
|
||||
|
||||
$arrayCalendar = self::$calendar->update($arrayRecord[0]["CAL_UID"], $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for calendar name existing
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the calendars
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The calendar name with CAL_NAME: "PHPUnit Calendar1" already exists.
|
||||
*/
|
||||
public function testUpdateExceptionExistsCalName($arrayRecord)
|
||||
{
|
||||
$arrayData = $arrayRecord[1];
|
||||
|
||||
$arrayCalendar = self::$calendar->update($arrayRecord[0]["CAL_UID"], $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete calendars
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Calendar::delete
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the calendars
|
||||
*/
|
||||
public function testDelete($arrayRecord)
|
||||
{
|
||||
foreach ($arrayRecord as $value) {
|
||||
self::$calendar->delete($value["CAL_UID"]);
|
||||
}
|
||||
|
||||
$arrayCalendar = self::$calendar->getCalendars(array("filter" => "PHPUnit"));
|
||||
|
||||
$this->assertTrue(is_array($arrayCalendar));
|
||||
$this->assertEmpty($arrayCalendar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,392 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Cases Test
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class CasesAction13_17Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $oCases;
|
||||
protected $nowCountTodo = 0;
|
||||
protected $nowCountDraft = 0;
|
||||
protected $nowCountPaused = 0;
|
||||
protected $idCaseToDo = '';
|
||||
protected $idCaseDraft = '';
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
\G::loadClass('pmFunctions');
|
||||
|
||||
$usrUid = '00000000000000000000000000000001';
|
||||
$proUid = '2317283235320c1a36972b2028131767';
|
||||
$tasUid = '7983935495320c1a75e1df6068322280';
|
||||
$idCaseToDo = PMFNewCase($proUid, $usrUid, $tasUid, array());
|
||||
PMFDerivateCase($idCaseToDo, 1);
|
||||
$this->idCaseToDo = $idCaseToDo;
|
||||
|
||||
$idCaseDraft = PMFNewCase($proUid, $usrUid, $tasUid, array());
|
||||
$this->idCaseDraft = $idCaseDraft;
|
||||
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$listToDo = $this->oCases->getList(array('userId' => '00000000000000000000000000000001'));
|
||||
$this->nowCountTodo = $listToDo['total'];
|
||||
|
||||
$listDraft = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'draft'));
|
||||
$this->nowCountDraft = $listDraft['total'];
|
||||
|
||||
$listPaused = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'paused'));
|
||||
$this->nowCountPaused = $listPaused['total'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putCancelCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$app_uid' it must be a string.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutCancelCaseErrorAppUidArray()
|
||||
{
|
||||
$this->oCases->putCancelCase(array(), '00000000000000000000000000000001');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putCancelCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The application with $app_uid: 'IdDoesNotExists' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutCancelCaseErrorAppUidIncorrect()
|
||||
{
|
||||
$this->oCases->putCancelCase('IdDoesNotExists', '00000000000000000000000000000001');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in second field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putCancelCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$usr_uid' it must be a string.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutCancelCaseErrorUsrUidArray()
|
||||
{
|
||||
$this->oCases->putCancelCase($this->idCaseDraft, array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in second field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putCancelCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The user with $usr_uid: 'IdDoesNotExists' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutCancelCaseErrorUsrUidIncorrect()
|
||||
{
|
||||
$this->oCases->putCancelCase($this->idCaseDraft, 'IdDoesNotExists');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in third field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putCancelCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$del_index' it must be a integer.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutCancelCaseErrorDelIndexIncorrect()
|
||||
{
|
||||
$this->oCases->putCancelCase($this->idCaseDraft, '00000000000000000000000000000001', 'string');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for cancel case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putCancelCase
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutCancelCase()
|
||||
{
|
||||
$this->oCases->putCancelCase($this->idCaseDraft, '00000000000000000000000000000001');
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$listDraft = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'draft'));
|
||||
$this->assertNotEquals($this->nowCountDraft, $listDraft['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putPauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$app_uid' it must be a string.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutPauseCaseErrorAppUidArray()
|
||||
{
|
||||
$this->oCases->putPauseCase(array(), '00000000000000000000000000000001');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putPauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The application with $app_uid: 'IdDoesNotExists' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutPauseCaseErrorAppUidIncorrect()
|
||||
{
|
||||
$this->oCases->putPauseCase('IdDoesNotExists', '00000000000000000000000000000001');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in second field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putPauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$usr_uid' it must be a string.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutPauseCaseErrorUsrUidArray()
|
||||
{
|
||||
$this->oCases->putPauseCase($this->idCaseDraft, array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in second field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putPauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The user with $usr_uid: 'IdDoesNotExists' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutPauseCaseErrorUsrUidIncorrect()
|
||||
{
|
||||
$this->oCases->putPauseCase($this->idCaseDraft, 'IdDoesNotExists');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in third field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putPauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$del_index' it must be a integer.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutPauseCaseErrorDelIndexIncorrect()
|
||||
{
|
||||
$this->oCases->putPauseCase($this->idCaseDraft, '00000000000000000000000000000001', 'string');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in fourth field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putPauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The value '2014-44-44' is not a valid date for the format 'Y-m-d'.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutPauseCaseErrorDateIncorrect()
|
||||
{
|
||||
$this->oCases->putPauseCase($this->idCaseDraft, '00000000000000000000000000000001', false, '2014-44-44');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for cancel case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putPauseCase
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutPauseCase()
|
||||
{
|
||||
$this->oCases->putPauseCase($this->idCaseToDo, '00000000000000000000000000000001');
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$listPaused = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'paused'));
|
||||
$this->assertNotEquals($this->nowCountPaused, $listPaused['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putUnpauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$app_uid' it must be a string.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutUnpauseCaseErrorAppUidArray()
|
||||
{
|
||||
$this->oCases->putUnpauseCase(array(), '00000000000000000000000000000001');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putUnpauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The application with $app_uid: 'IdDoesNotExists' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutUnpauseCaseErrorAppUidIncorrect()
|
||||
{
|
||||
$this->oCases->putUnpauseCase('IdDoesNotExists', '00000000000000000000000000000001');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in second field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putUnpauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$usr_uid' it must be a string.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutUnpauseCaseErrorUsrUidArray()
|
||||
{
|
||||
$this->oCases->putUnpauseCase($this->idCaseDraft, array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in second field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putUnpauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The user with $usr_uid: 'IdDoesNotExists' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutUnpauseCaseErrorUsrUidIncorrect()
|
||||
{
|
||||
$this->oCases->putUnpauseCase($this->idCaseDraft, 'IdDoesNotExists');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in third field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putUnpauseCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$del_index' it must be a integer.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutUnpauseCaseErrorDelIndexIncorrect()
|
||||
{
|
||||
$this->oCases->putUnpauseCase($this->idCaseDraft, '00000000000000000000000000000001', 'string');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for cancel case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::putUnpauseCase
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testPutUnpauseCase()
|
||||
{
|
||||
$this->oCases->putUnpauseCase($this->idCaseToDo, '00000000000000000000000000000001');
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$listPaused = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'paused'));
|
||||
$this->assertEquals($this->nowCountPaused, $listPaused['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::deleteCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$app_uid' it must be a string.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testDeleteCaseErrorAppUidArray()
|
||||
{
|
||||
$this->oCases->deleteCase(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::deleteCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The application with $app_uid: 'IdDoesNotExists' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testDeleteCaseErrorAppUidIncorrect()
|
||||
{
|
||||
$this->oCases->deleteCase('IdDoesNotExists');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for cancel case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::deleteCase
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testDeleteCase()
|
||||
{
|
||||
$this->oCases->deleteCase($this->idCaseToDo);
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$listToDo = $this->oCases->getList(array('userId' => '00000000000000000000000000000001'));
|
||||
$this->assertNotEquals($this->nowCountTodo, $listToDo['total']);
|
||||
}
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Cases Test
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class CasesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $oCases;
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$dataList' it must be an array.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesErrorArray()
|
||||
{
|
||||
$this->oCases->getList(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for empty userId in array
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The user with userId: '' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesErrorUserIdArray()
|
||||
{
|
||||
$this->oCases->getList(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for not exists userId in array
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The user with userId: 'UidInexistente' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesErrorNotExistsUserIdArray()
|
||||
{
|
||||
$this->oCases->getList(array('userId' => 'UidInexistente'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value $action in array
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The value for $action is incorrect.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesErrorIncorrectValueArray()
|
||||
{
|
||||
$this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'incorrect'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list to do
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesToDo()
|
||||
{
|
||||
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001'));
|
||||
$this->assertTrue(is_array($response));
|
||||
$this->assertTrue(is_numeric($response['totalCount']));
|
||||
$this->assertTrue(is_array($response['data']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list draft
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesDraft()
|
||||
{
|
||||
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'draft'));
|
||||
$this->assertTrue(is_array($response));
|
||||
$this->assertTrue(is_numeric($response['totalCount']));
|
||||
$this->assertTrue(is_array($response['data']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list participated
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesParticipated()
|
||||
{
|
||||
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'sent'));
|
||||
$this->assertTrue(is_array($response));
|
||||
$this->assertTrue(is_numeric($response['totalCount']));
|
||||
$this->assertTrue(is_array($response['data']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list unassigned
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesUnassigned()
|
||||
{
|
||||
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'unassigned'));
|
||||
$this->assertTrue(is_array($response));
|
||||
$this->assertTrue(is_numeric($response['totalCount']));
|
||||
$this->assertTrue(is_array($response['data']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list search
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getList
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetListCasesSearch()
|
||||
{
|
||||
$response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'search'));
|
||||
$this->assertTrue(is_array($response));
|
||||
$this->assertTrue(is_numeric($response['totalCount']));
|
||||
$this->assertTrue(is_array($response['data']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,356 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Cases Test
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class CasesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $oCases;
|
||||
protected $idCase = '';
|
||||
|
||||
protected static $usrUid = "00000000000000000000000000000001";
|
||||
protected static $usrUid2 = "00000000000000000000000000000012";
|
||||
protected static $proUid = "00000000000000000000000000000003";
|
||||
protected static $tasUid = "00000000000000000000000000000004";
|
||||
protected static $tasUid2 = "00000000000000000000000000000005";
|
||||
protected static $tasUid3 = "00000000000000000000000000000006";
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$process = new \Process();
|
||||
$process->create(array("type"=>"classicProject", "PRO_TITLE"=> "NEW TEST PHP UNIT", "PRO_DESCRIPTION"=> "465",
|
||||
"PRO_CATEGORY"=> "", "PRO_CREATE_USER"=> "00000000000000000000000000000001",
|
||||
"PRO_UID"=> self::$proUid, "USR_UID"=> "00000000000000000000000000000001"), false);
|
||||
|
||||
$task = new \Task();
|
||||
$task->create(array("TAS_START"=>"TRUE", "TAS_UID"=> self::$tasUid, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TEST PHP UNIT",
|
||||
"TAS_POSX"=> 581, "TAS_POSY"=> 47, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
|
||||
$task = new \Task();
|
||||
$task->create(array( "TAS_UID"=> self::$tasUid2, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK ONE",
|
||||
"TAS_POSX"=> 481, "TAS_POSY"=> 127, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
|
||||
$task = new \Task();
|
||||
$task->create(array( "TAS_UID"=> self::$tasUid3, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TWO",
|
||||
"TAS_POSX"=> 681, "TAS_POSY"=> 127, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
|
||||
|
||||
$nw = new \processMap();
|
||||
$nw->saveNewPattern(self::$proUid, self::$tasUid, self::$tasUid2, 'PARALLEL', true);
|
||||
$nw = new \processMap();
|
||||
$nw->saveNewPattern(self::$proUid, self::$tasUid, self::$tasUid3, 'PARALLEL', true);
|
||||
|
||||
$user = new \Users();
|
||||
$user->create(array("USR_ROLE"=> "PROCESSMAKER_ADMIN","USR_UID"=> self::$usrUid2, "USR_USERNAME"=> "dummy",
|
||||
"USR_PASSWORD"=>"21232f297a57a5a743894a0e4a801fc3", "USR_FIRSTNAME"=>"dummy_firstname", "USR_LASTNAME"=>"dummy_lastname",
|
||||
"USR_EMAIL"=>"dummy@dummy.com", "USR_DUE_DATE"=>'2020-01-01', "USR_CREATE_DATE"=>"2014-01-01 12:00:00", "USR_UPDATE_DATE"=>"2014-01-01 12:00:00",
|
||||
"USR_STATUS"=>"ACTIVE", "USR_UX"=>"NORMAL"));
|
||||
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid2, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid2, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid2, "USR_UID"=> self::$usrUid2, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid3, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid3, "USR_UID"=> self::$usrUid2, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of process in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::addCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid process 12345678912345678912345678912345678
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCaseErrorIncorrectProcessValueArray()
|
||||
{
|
||||
$this->oCases->addCase('12345678912345678912345678912345678', self::$tasUid, self::$usrUid, array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of task in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::addCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Task invalid or the user is not assigned to the task
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCaseErrorIncorrectTaskValueArray()
|
||||
{
|
||||
$this->oCases->addCase(self::$proUid, '12345678912345678912345678912345678', self::$usrUid, array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add Case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::addCase
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCase()
|
||||
{
|
||||
$response = $this->oCases->addCase(self::$proUid, self::$tasUid, self::$usrUid, array());
|
||||
$this->assertTrue(is_object($response));
|
||||
$aResponse = json_decode(json_encode($response), true);
|
||||
return $aResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of case in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::getTaskCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Incorrect or unavailable information about this case: 12345678912345678912345678912345678
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetTaskCaseErrorIncorrectCaseValueArray()
|
||||
{
|
||||
$this->oCases->getTaskCase('12345678912345678912345678912345678', self::$usrUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get Task Case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::getTaskCase
|
||||
* @depends testAddCase
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetTaskCase(array $aResponse)
|
||||
{
|
||||
$response = $this->oCases->getTaskCase($aResponse['app_uid'], self::$usrUid);
|
||||
$this->assertTrue(is_array($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of case in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::getCaseInfo
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCaseInfoErrorIncorrectCaseValueArray()
|
||||
{
|
||||
$this->oCases->getCaseInfo('12345678912345678912345678912345678', self::$usrUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get Case Info
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::getCaseInfo
|
||||
* @depends testAddCase
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCaseInfo(array $aResponse)
|
||||
{
|
||||
$response = $this->oCases->getCaseInfo($aResponse['app_uid'], self::$usrUid);
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of user delegation in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::updateReassignCase
|
||||
* @depends testAddCase
|
||||
* @param array $aResponse
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid Case Delegation index for this user
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateReassignCaseErrorIncorrectUserValueArray(array $aResponse)
|
||||
{
|
||||
$this->oCases->updateReassignCase($aResponse['app_uid'], self::$usrUid, null, self::$usrUid, self::$usrUid2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of case in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::updateReassignCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The Application with app_uid: 12345678912345678912345678912345678 doesn't exist
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateReassignCaseErrorIncorrectCaseValueArray()
|
||||
{
|
||||
$this->oCases->updateReassignCase('12345678912345678912345678912345678', self::$usrUid, null, self::$usrUid2, self::$usrUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test put reassign case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::updateReassignCase
|
||||
* @depends testAddCase
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateReassignCase(array $aResponse)
|
||||
{
|
||||
$response = $this->oCases->updateReassignCase($aResponse['app_uid'], self::$usrUid, null, self::$usrUid2, self::$usrUid);
|
||||
$this->assertTrue(empty($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add Case to test route case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::addCase
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCaseRouteCase()
|
||||
{
|
||||
$response = $this->oCases->addCase(self::$proUid, self::$tasUid, self::$usrUid, array());
|
||||
$this->assertTrue(is_object($response));
|
||||
$aResponseRouteCase = json_decode(json_encode($response), true);
|
||||
return $aResponseRouteCase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of case in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::updateRouteCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The row '12345678912345678912345678912345678, ' in table AppDelegation doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateRouteCaseErrorIncorrectCaseValueArray()
|
||||
{
|
||||
$this->oCases->updateRouteCase('12345678912345678912345678912345678', self::$usrUid, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test put route case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::updateRouteCase
|
||||
* @depends testAddCaseRouteCase
|
||||
* @param array $aResponseRouteCase
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateRouteCase(array $aResponseRouteCase)
|
||||
{
|
||||
$response = $this->oCases->updateRouteCase($aResponseRouteCase['app_uid'], self::$usrUid, null);
|
||||
$this->assertTrue(empty($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of process in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::addCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid process 12345678912345678912345678912345678
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCaseImpersonateErrorIncorrectProcessValueArray()
|
||||
{
|
||||
$this->oCases->addCaseImpersonate('12345678912345678912345678912345678', self::$usrUid2, self::$tasUid, array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of task in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::addCase
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage User not registered! 12345678912345678912345678912345678!!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCaseImpersonateErrorIncorrectTaskValueArray()
|
||||
{
|
||||
$this->oCases->addCaseImpersonate(self::$proUid, '12345678912345678912345678912345678', self::$tasUid, array());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test add Case impersonate
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::addCaseImpersonate
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCaseImpersonate()
|
||||
{
|
||||
$response = $this->oCases->addCaseImpersonate(self::$proUid, self::$usrUid2, self::$tasUid, array());
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$assign = new \TaskUser();
|
||||
$assign->remove(self::$tasUid, self::$usrUid, 1,1);
|
||||
|
||||
$task = new \Task();
|
||||
$task->remove(self::$tasUid);
|
||||
|
||||
$task = new \Task();
|
||||
$task->remove(self::$tasUid2);
|
||||
|
||||
$task = new \Task();
|
||||
$task->remove(self::$tasUid3);
|
||||
|
||||
$process = new \Process();
|
||||
$process->remove(self::$proUid);
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\RoutePeer::PRO_UID);
|
||||
$criteria->add(\RoutePeer::PRO_UID, self::$proUid, \Criteria::EQUAL);
|
||||
\ProcessFilesPeer::doDelete($criteria);
|
||||
|
||||
$user = new \Users();
|
||||
$user->remove(self::$usrUid2);
|
||||
|
||||
$oConnection = \Propel::getConnection( \UsersPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oUser = \UsersPeer::retrieveByPK( self::$usrUid2 );
|
||||
if (! is_null( $oUser )) {
|
||||
$oConnection->begin();
|
||||
$oUser->delete();
|
||||
$oConnection->commit();
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,354 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Department Test
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class DepartmentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $oDepartment;
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$dep_data' it must be an array.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorArray()
|
||||
{
|
||||
$this->oDepartment->saveDepartment(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for type in second field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for '$create' it must be a boolean.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorBoolean()
|
||||
{
|
||||
$this->oDepartment->saveDepartment(array('1'),array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for empty array in first field the function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The field '$dep_data' is empty.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorArrayEmpty()
|
||||
{
|
||||
$this->oDepartment->saveDepartment(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for create department with nonexistent dep_parent
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The departament with dep_parent: 'testUidDepartment' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorArrayDepParentExist()
|
||||
{
|
||||
$data = array('dep_parent' => 'testUidDepartment');
|
||||
$this->oDepartment->saveDepartment($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for create department with nonexistent dep_manager
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The user with dep_manager: 'testUidUser' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorArrayDepManagerExist()
|
||||
{
|
||||
$data = array('dep_manager' => 'testUidUser');
|
||||
$this->oDepartment->saveDepartment($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for create department with incorrect dep_status
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The departament with dep_status: 'SUPER ACTIVO' is incorrect.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorArrayDepStatus()
|
||||
{
|
||||
$data = array('dep_status' => 'SUPER ACTIVO');
|
||||
$this->oDepartment->saveDepartment($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for create department untitled
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The field dep_title is required.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorArrayDepTitleEmpty()
|
||||
{
|
||||
$data = array('dep_status' => 'ACTIVE');
|
||||
$this->oDepartment->saveDepartment($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save department parent
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentParent()
|
||||
{
|
||||
$data = array('dep_title' => 'Departamento Padre');
|
||||
$dep_data = $this->oDepartment->saveDepartment($data);
|
||||
$this->assertTrue(is_array($dep_data));
|
||||
$this->assertTrue(isset($dep_data['dep_uid']));
|
||||
$this->assertEquals($dep_data['dep_parent'], '');
|
||||
$this->assertEquals($dep_data['dep_title'], 'Departamento Padre');
|
||||
$this->assertEquals($dep_data['dep_status'], 'ACTIVE');
|
||||
$this->assertEquals($dep_data['dep_manager'], '');
|
||||
$this->assertEquals($dep_data['has_children'], 0);
|
||||
return $dep_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for create department with title exist
|
||||
*
|
||||
* @depends testCreateDepartmentParent
|
||||
* @param array $dep_data, Data for parent department
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The departament with dep_title: 'Departamento Padre' already exists.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentErrorArrayDepTitleRepeated(array $dep_data)
|
||||
{
|
||||
$data = array('dep_title' => 'Departamento Padre');
|
||||
$this->oDepartment->saveDepartment($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for create department untitled
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The departament with dep_uid: 'testUidDepartment' does not exist.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateDepartmentErrorArrayDepUidExist()
|
||||
{
|
||||
$data = array('dep_uid' => 'testUidDepartment');
|
||||
$this->oDepartment->saveDepartment($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save department child
|
||||
*
|
||||
* @depends testCreateDepartmentParent
|
||||
* @param array $dep_data, Data for parent department
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testCreateDepartmentChild(array $dep_data)
|
||||
{
|
||||
$data = array(
|
||||
'dep_title' => 'Departamento Child',
|
||||
'dep_parent' => $dep_data['dep_uid'],
|
||||
'dep_status' => 'INACTIVE',
|
||||
'dep_manager' => '00000000000000000000000000000001'
|
||||
);
|
||||
$child_data = $this->oDepartment->saveDepartment($data);
|
||||
$this->assertTrue(is_array($child_data));
|
||||
$this->assertTrue(isset($child_data['dep_uid']));
|
||||
$this->assertEquals($child_data['dep_parent'], $dep_data['dep_uid']);
|
||||
$this->assertEquals($child_data['dep_title'], 'Departamento Child');
|
||||
$this->assertEquals($child_data['dep_status'], 'INACTIVE');
|
||||
$this->assertEquals($child_data['dep_manager'], '00000000000000000000000000000001');
|
||||
$this->assertEquals($child_data['has_children'], 0);
|
||||
return $child_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for update department with title exist
|
||||
*
|
||||
* @depends testCreateDepartmentParent
|
||||
* @depends testCreateDepartmentChild
|
||||
* @param array $dep_data, Data for parent department
|
||||
* @param array $child_data, Data for child department
|
||||
* @covers \ProcessMaker\BusinessModel\Department::saveDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The departament with dep_title: 'Departamento Padre' already exists.
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateDepartmentErrorArrayDepTitleRepeated(array $dep_data, array $child_data)
|
||||
{
|
||||
$dataUpdate = array (
|
||||
'dep_uid' => $child_data['dep_uid'],
|
||||
'dep_title' => 'Departamento Padre'
|
||||
);
|
||||
$this->oDepartment->saveDepartment($dataUpdate, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get departments array
|
||||
*
|
||||
* @depends testCreateDepartmentParent
|
||||
* @depends testCreateDepartmentChild
|
||||
* @param array $dep_data, Data for parent department
|
||||
* @param array $child_data, Data for child department
|
||||
* @covers \ProcessMaker\BusinessModel\Department::getDepartments
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetDepartments(array $dep_data, array $child_data)
|
||||
{
|
||||
$arrayDepartments = $this->oDepartment->getDepartments();
|
||||
$this->assertTrue(is_array($arrayDepartments));
|
||||
$this->assertEquals(count($arrayDepartments), 1);
|
||||
$this->assertTrue(is_array($arrayDepartments[0]['dep_children']));
|
||||
$this->assertEquals(count($arrayDepartments[0]['dep_children']), 1);
|
||||
|
||||
$dataParent = $arrayDepartments[0];
|
||||
$this->assertEquals($dep_data['dep_parent'], $dataParent['dep_parent']);
|
||||
$this->assertEquals($dep_data['dep_title'], $dataParent['dep_title']);
|
||||
$this->assertEquals($dep_data['dep_status'], $dataParent['dep_status']);
|
||||
$this->assertEquals($dep_data['dep_manager'], $dataParent['dep_manager']);
|
||||
|
||||
$dataChild = $arrayDepartments[0]['dep_children'][0];
|
||||
$this->assertEquals($child_data['dep_parent'], $dataChild['dep_parent']);
|
||||
$this->assertEquals($child_data['dep_title'], $dataChild['dep_title']);
|
||||
$this->assertEquals($child_data['dep_status'], $dataChild['dep_status']);
|
||||
$this->assertEquals($child_data['dep_manager'], $dataChild['dep_manager']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get department array
|
||||
*
|
||||
* @depends testCreateDepartmentParent
|
||||
* @param array $dep_data, Data for parent department
|
||||
* @covers \ProcessMaker\BusinessModel\Department::getDepartment
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetDepartment(array $dep_data)
|
||||
{
|
||||
$dataParent = $this->oDepartment->getDepartment($dep_data['dep_uid']);
|
||||
$this->assertTrue(is_array($dataParent));
|
||||
|
||||
$this->assertEquals($dep_data['dep_parent'], $dataParent['dep_parent']);
|
||||
$this->assertEquals($dep_data['dep_title'], $dataParent['dep_title']);
|
||||
$this->assertEquals($dep_data['dep_status'], $dataParent['dep_status']);
|
||||
$this->assertEquals($dep_data['dep_manager'], $dataParent['dep_manager']);
|
||||
}
|
||||
|
||||
// TODO: Assigned Users to department
|
||||
public function testDeleteDepartmentErrorUsersSelections()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for delete department with children
|
||||
*
|
||||
* @depends testCreateDepartmentParent
|
||||
* @depends testCreateDepartmentChild
|
||||
* @param array $dep_data, Data for parent department
|
||||
* @param array $child_data, Data for child department
|
||||
* @covers \ProcessMaker\BusinessModel\Department::deleteDepartment
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Can not delete the department, it has a children department.
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testDeleteDepartmentErrorDepartmentParent(array $dep_data, array $child_data)
|
||||
{
|
||||
$this->oDepartment->deleteDepartment($dep_data['dep_uid']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get departments array
|
||||
*
|
||||
* @depends testCreateDepartmentParent
|
||||
* @depends testCreateDepartmentChild
|
||||
* @param array $dep_data, Data for parent department
|
||||
* @param array $child_data, Data for child department
|
||||
* @covers \ProcessMaker\BusinessModel\Department::deleteDepartment
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testDeleteDepartments(array $dep_data, array $child_data)
|
||||
{
|
||||
$this->oDepartment->deleteDepartment($child_data['dep_uid']);
|
||||
$this->oDepartment->deleteDepartment($dep_data['dep_uid']);
|
||||
$dataParent = $this->oDepartment->getDepartments();
|
||||
$this->assertTrue(empty($dataParent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Documents Cases Test
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $oInputDocument;
|
||||
protected $idCase = '';
|
||||
|
||||
protected static $usrUid = "00000000000000000000000000000001";
|
||||
protected static $proUid = "00000000000000000000000000000002";
|
||||
protected static $tasUid = "00000000000000000000000000000003";
|
||||
protected static $inpUid = "00000000000000000000000000000004";
|
||||
protected static $steUid = "00000000000000000000000000000005";
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$process = new \Process();
|
||||
$process->create(array("type"=>"classicProject", "PRO_TITLE"=> "NEW TEST PHP UNIT", "PRO_DESCRIPTION"=> "465",
|
||||
"PRO_CATEGORY"=> "", "PRO_CREATE_USER"=> "00000000000000000000000000000001",
|
||||
"PRO_UID"=> self::$proUid, "USR_UID"=> "00000000000000000000000000000001"), false);
|
||||
|
||||
$task = new \Task();
|
||||
$task->create(array("TAS_START"=>"TRUE", "TAS_UID"=> self::$tasUid, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TEST PHP UNIT",
|
||||
"TAS_POSX"=> 581, "TAS_POSY"=> 17, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
|
||||
|
||||
$inputDocument = new \InputDocument();
|
||||
$inputDocument->create(array("INP_DOC_UID"=> self::$inpUid, "PRO_UID"=> self::$proUid, "INP_DOC_TITLE"=> "INPUTDOCUMENT TEST UNIT", "INP_DOC_FORM_NEEDED"=> "VIRTUAL",
|
||||
"INP_DOC_ORIGINAL"=> "ORIGINAL", "INP_DOC_DESCRIPTION"=> "", "INP_DOC_VERSIONING"=> "",
|
||||
"INP_DOC_DESTINATION_PATH"=> "", "INP_DOC_TAGS"=> "INPUT", "ACCEPT"=> "Save", "BTN_CANCEL"=>"Cancel"));
|
||||
|
||||
$step = new \Step();
|
||||
$step->create(array( "PRO_UID"=> self::$proUid, "TAS_UID"=> self::$tasUid, "STEP_UID"=> self::$steUid, "STEP_TYPE_OBJ" => "INPUT_DOCUMENT", "STEP_UID_OBJ" =>self::$inpUid));
|
||||
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$assign = new \TaskUser();
|
||||
$assign->remove(self::$tasUid, self::$usrUid, 1,1);
|
||||
|
||||
$step = new \Step();
|
||||
$step->remove(self::$steUid);
|
||||
|
||||
$inputDocument = new \InputDocument();
|
||||
$inputDocument->remove(self::$inpUid);
|
||||
|
||||
$task = new \Task();
|
||||
$task->remove(self::$tasUid);
|
||||
|
||||
$process = new \Process();
|
||||
$process->remove(self::$proUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oInputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add a test InputDocument
|
||||
*
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddInputDocument()
|
||||
{
|
||||
\G::loadClass('pmFunctions');
|
||||
$idCase = PMFNewCase(self::$proUid, self::$usrUid, self::$tasUid, array());
|
||||
$case = new \Cases();
|
||||
$appDocUid = $case->addInputDocument(self::$inpUid, $appDocUid = \G::generateUniqueID(), '', 'INPUT',
|
||||
'PHPUNIT TEST', '', $idCase, \AppDelegation::getCurrentIndex($idCase),
|
||||
self::$tasUid, self::$usrUid, "xmlform", PATH_DATA_SITE.'db.php',
|
||||
0, PATH_DATA_SITE.'db.php');
|
||||
$aResponse = array();
|
||||
$aResponse = array_merge(array("idCase" => $idCase, "appDocUid" => $appDocUid, "inpDocUid" => self::$inpUid), $aResponse);
|
||||
return $aResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of case in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocuments
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesInputDocumentsErrorIncorrectCaseValueArray()
|
||||
{
|
||||
$this->oInputDocument->getCasesInputDocuments('12345678912345678912345678912345678', self::$usrUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get InputDocuments
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocuments
|
||||
* @depends testAddInputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesInputDocuments(array $aResponse)
|
||||
{
|
||||
$response = $this->oInputDocument->getCasesInputDocuments($aResponse["idCase"], self::$usrUid);
|
||||
$this->assertTrue(is_array($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of task in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocument
|
||||
* @depends testAddInputDocument
|
||||
* @param array $aResponse
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesInputDocumentErrorIncorrectCaseValueArray(array $aResponse)
|
||||
{
|
||||
$this->oInputDocument->getCasesInputDocument('12345678912345678912345678912345678', self::$usrUid, $aResponse["appDocUid"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of input document in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocument
|
||||
* @depends testAddInputDocument
|
||||
* @param array $aResponse
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage This input document with id: 12345678912345678912345678912345678 doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesInputDocumentErrorIncorrectInputDocumentValueArray(array $aResponse)
|
||||
{
|
||||
$this->oInputDocument->getCasesInputDocument($aResponse["idCase"], self::$usrUid, '12345678912345678912345678912345678');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get InputDocument
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocument
|
||||
* @depends testAddInputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesInputDocument(array $aResponse)
|
||||
{
|
||||
$response = $this->oInputDocument->getCasesInputDocument($aResponse["idCase"], self::$usrUid, $aResponse["appDocUid"]);
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of input document in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::removeInputDocument
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage This input document with id: 12345678912345678912345678912345678 doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testRemoveInputDocumentErrorIncorrectApplicationValueArray()
|
||||
{
|
||||
$this->oInputDocument->removeInputDocument('12345678912345678912345678912345678');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test remove InputDocument
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::removeInputDocument
|
||||
* @depends testAddInputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testRemoveInputDocument(array $aResponse)
|
||||
{
|
||||
$response = $this->oInputDocument->removeInputDocument($aResponse["appDocUid"]);
|
||||
$this->assertTrue(empty($response));
|
||||
}
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Documents Cases Test
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $oOutputDocument;
|
||||
protected $idCase = '';
|
||||
|
||||
protected static $usrUid = "00000000000000000000000000000001";
|
||||
protected static $proUid = "00000000000000000000000000000002";
|
||||
protected static $tasUid = "00000000000000000000000000000003";
|
||||
protected static $outUid = "00000000000000000000000000000004";
|
||||
protected static $steUid = "00000000000000000000000000000005";
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$process = new \Process();
|
||||
$process->create(array("type"=>"classicProject", "PRO_TITLE"=> "NEW TEST PHP UNIT", "PRO_DESCRIPTION"=> "465",
|
||||
"PRO_CATEGORY"=> "", "PRO_CREATE_USER"=> "00000000000000000000000000000001",
|
||||
"PRO_UID"=> self::$proUid, "USR_UID"=> "00000000000000000000000000000001"), false);
|
||||
|
||||
$task = new \Task();
|
||||
$task->create(array("TAS_START"=>"TRUE", "TAS_UID"=> self::$tasUid, "PRO_UID"=> self::$proUid, "TAS_TITLE" => "NEW TASK TEST PHP UNIT",
|
||||
"TAS_POSX"=> 581, "TAS_POSY"=> 17, "TAS_WIDTH"=> 165, "TAS_HEIGHT"=> 40), false);
|
||||
|
||||
$outputDocument = new \OutputDocument();
|
||||
$outputDocument->create(array("OUT_DOC_UID"=> self::$outUid, "PRO_UID"=> self::$proUid, "OUT_DOC_TITLE"=> "NEW OUPUT TEST", "OUT_DOC_FILENAME"=> "NEW_OUPUT_TEST",
|
||||
"OUT_DOC_DESCRIPTION"=> "", "OUT_DOC_REPORT_GENERATOR"=> "HTML2PDF", "OUT_DOC_REPORT_GENERATOR_label"=> "HTML2PDF (Old Version)",
|
||||
"OUT_DOC_LANDSCAPE"=> "", "OUT_DOC_LANDSCAPE_label"=> "Portrait", "OUT_DOC_GENERATE"=> "BOTH", "OUT_DOC_GENERATE_label"=> "BOTH",
|
||||
"OUT_DOC_VERSIONING"=> "", "OUT_DOC_VERSIONING_label"=> "NO", "OUT_DOC_MEDIA"=> "Letter", "OUT_DOC_MEDIA_label"=> "Letter",
|
||||
"OUT_DOC_LEFT_MARGIN"=> "", "OUT_DOC_RIGHT_MARGIN"=> "", "OUT_DOC_TOP_MARGIN"=> "", "OUT_DOC_BOTTOM_MARGIN"=> "",
|
||||
"OUT_DOC_DESTINATION_PATH"=> "", "OUT_DOC_TAGS"=> "", "OUT_DOC_PDF_SECURITY_ENABLED"=> "0", "OUT_DOC_PDF_SECURITY_ENABLED_label"=> "Disabled",
|
||||
"OUT_DOC_PDF_SECURITY_OPEN_PASSWORD"=>"", "OUT_DOC_PDF_SECURITY_OWNER_PASSWORD"=> "", "OUT_DOC_PDF_SECURITY_PERMISSIONS"=> "",
|
||||
"OUT_DOC_OPEN_TYPE"=> "0", "OUT_DOC_OPEN_TYPE_label"=> "Download the file", "BTN_CANCEL"=> "Cancel", "ACCEPT"=> "Save"));
|
||||
|
||||
$step = new \Step();
|
||||
$step->create(array( "PRO_UID"=> self::$proUid, "TAS_UID"=> self::$tasUid, "STEP_UID"=> self::$steUid, "STEP_TYPE_OBJ" => "OUTPUT_DOCUMENT", "STEP_UID_OBJ" =>self::$outUid));
|
||||
|
||||
$assign = new \TaskUser();
|
||||
$assign->create(array("TAS_UID"=> self::$tasUid, "USR_UID"=> self::$usrUid, "TU_TYPE"=> "1", "TU_RELATION"=> 1));
|
||||
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$assign = new \TaskUser();
|
||||
$assign->remove(self::$tasUid, self::$usrUid, 1,1);
|
||||
|
||||
$step = new \Step();
|
||||
$step->remove(self::$steUid);
|
||||
|
||||
$outputDocument = new \OutputDocument();
|
||||
$outputDocument->remove(self::$outUid);
|
||||
|
||||
$task = new \Task();
|
||||
$task->remove(self::$tasUid);
|
||||
|
||||
$process = new \Process();
|
||||
$process->remove(self::$proUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oOutputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add OutputDocument
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::addCasesOutputDocument
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCasesOutputDocument()
|
||||
{
|
||||
\G::loadClass('pmFunctions');
|
||||
$idCase = PMFNewCase(self::$proUid, self::$usrUid, self::$tasUid, array());
|
||||
$response = $this->oOutputDocument->addCasesOutputDocument($idCase, self::$outUid, self::$usrUid);
|
||||
$this->assertTrue(is_object($response));
|
||||
$aResponse = json_decode(json_encode($response), true);
|
||||
$aResponse = array_merge(array("idCase" => $idCase), $aResponse);
|
||||
return $aResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of application in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::getCasesOutputDocuments
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesOutputDocumentsErrorIncorrectApplicationValueArray()
|
||||
{
|
||||
$this->oOutputDocument->getCasesOutputDocuments('12345678912345678912345678912345678', self::$usrUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get OutputDocuments
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::getCasesOutputDocuments
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesOutputDocuments(array $aResponse)
|
||||
{
|
||||
$response = $this->oOutputDocument->getCasesOutputDocuments($aResponse["idCase"], self::$usrUid);
|
||||
$this->assertTrue(is_array($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of application in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::getCasesOutputDocument
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The Application row '12345678912345678912345678912345678' doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesOutputDocumentErrorIncorrectApplicationValueArray(array $aResponse)
|
||||
{
|
||||
$this->oOutputDocument->getCasesOutputDocument('12345678912345678912345678912345678', self::$usrUid, $aResponse["app_doc_uid"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of output document in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::getCasesOutputDocument
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage This output document with id: 12345678912345678912345678912345678 doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesOutputDocumentErrorIncorrectOutputDocumentValueArray(array $aResponse)
|
||||
{
|
||||
$this->oOutputDocument->getCasesOutputDocument($aResponse["idCase"], self::$usrUid, '12345678912345678912345678912345678');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get OutputDocument
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::getCasesOutputDocument
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesOutputDocument(array $aResponse)
|
||||
{
|
||||
$response = $this->oOutputDocument->getCasesOutputDocument($aResponse["idCase"], self::$usrUid, $aResponse["app_doc_uid"]);
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error for incorrect value of output document in array
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::removeOutputDocument
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage This output document with id: 12345678912345678912345678912345678 doesn't exist!
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testRemoveOutputDocumentErrorIncorrectOutputDocumentValueArray()
|
||||
{
|
||||
$this->oOutputDocument->removeOutputDocument('12345678912345678912345678912345678');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test remove OutputDocument
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\OutputDocument::removeOutputDocument
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testRemoveOutputDocument(array $aResponse)
|
||||
{
|
||||
$response = $this->oOutputDocument->removeOutputDocument($aResponse["app_doc_uid"]);
|
||||
$this->assertTrue(empty($response));
|
||||
|
||||
//remove Case
|
||||
$case = new \Cases();
|
||||
$case->removeCase( $aResponse["idCase"] );
|
||||
}
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
require_once(__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class ProcessCategoryTest
|
||||
*
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $category;
|
||||
protected static $numCategory = 2;
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$category = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create categories
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::create
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$arrayRecord = array();
|
||||
|
||||
//Create
|
||||
for ($i = 0; $i <= self::$numCategory - 1; $i++) {
|
||||
$arrayData = array(
|
||||
"CAT_NAME" => "PHPUnit My Category " . $i
|
||||
);
|
||||
|
||||
$arrayCategory = self::$category->create($arrayData);
|
||||
|
||||
$this->assertTrue(is_array($arrayCategory));
|
||||
$this->assertNotEmpty($arrayCategory);
|
||||
|
||||
$this->assertTrue(isset($arrayCategory["CAT_UID"]));
|
||||
|
||||
$arrayRecord[] = $arrayCategory;
|
||||
}
|
||||
|
||||
//Create - Japanese characters
|
||||
$arrayData = array(
|
||||
"CAT_NAME" => "テスト(PHPUnitの)",
|
||||
);
|
||||
|
||||
$arrayCategory = self::$category->create($arrayData);
|
||||
|
||||
$this->assertTrue(is_array($arrayCategory));
|
||||
$this->assertNotEmpty($arrayCategory);
|
||||
|
||||
$this->assertTrue(isset($arrayCategory["CAT_UID"]));
|
||||
|
||||
$arrayRecord[] = $arrayCategory;
|
||||
|
||||
//Return
|
||||
return $arrayRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update categories
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the categories
|
||||
*/
|
||||
public function testUpdate(array $arrayRecord)
|
||||
{
|
||||
$arrayData = array("CAT_NAME" => "PHPUnit My Category 1...");
|
||||
|
||||
$arrayCategory = self::$category->update($arrayRecord[1]["CAT_UID"], $arrayData);
|
||||
|
||||
$arrayCategory = self::$category->getCategory($arrayRecord[1]["CAT_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayCategory));
|
||||
$this->assertNotEmpty($arrayCategory);
|
||||
|
||||
$this->assertEquals($arrayCategory["CAT_NAME"], $arrayData["CAT_NAME"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get categories
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::getCategories
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the categories
|
||||
*/
|
||||
public function testGetCategories(array $arrayRecord)
|
||||
{
|
||||
$arrayCategory = self::$category->getCategories();
|
||||
|
||||
$this->assertNotEmpty($arrayCategory);
|
||||
|
||||
$arrayCategory = self::$category->getCategories(null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayCategory);
|
||||
|
||||
$arrayCategory = self::$category->getCategories(array("filter" => "PHPUnit"));
|
||||
|
||||
$this->assertTrue(is_array($arrayCategory));
|
||||
$this->assertNotEmpty($arrayCategory);
|
||||
|
||||
$this->assertEquals($arrayCategory[0]["CAT_UID"], $arrayRecord[0]["CAT_UID"]);
|
||||
$this->assertEquals($arrayCategory[0]["CAT_NAME"], $arrayRecord[0]["CAT_NAME"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get category
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::getCategory
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the categories
|
||||
*/
|
||||
public function testGetCategory(array $arrayRecord)
|
||||
{
|
||||
//Get
|
||||
$arrayCategory = self::$category->getCategory($arrayRecord[0]["CAT_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayCategory));
|
||||
$this->assertNotEmpty($arrayCategory);
|
||||
|
||||
$this->assertEquals($arrayCategory["CAT_UID"], $arrayRecord[0]["CAT_UID"]);
|
||||
$this->assertEquals($arrayCategory["CAT_NAME"], $arrayRecord[0]["CAT_NAME"]);
|
||||
|
||||
//Get - Japanese characters
|
||||
$arrayCategory = self::$category->getCategory($arrayRecord[self::$numCategory]["CAT_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayCategory));
|
||||
$this->assertNotEmpty($arrayCategory);
|
||||
|
||||
$this->assertEquals($arrayCategory["CAT_UID"], $arrayRecord[self::$numCategory]["CAT_UID"]);
|
||||
$this->assertEquals($arrayCategory["CAT_NAME"], "テスト(PHPUnitの)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayCategory = self::$category->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for required data (CAT_NAME)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Undefined value for "CAT_NAME", it is required.
|
||||
*/
|
||||
public function testCreateExceptionRequiredDataCatName()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAT_NAMEX" => "PHPUnit My Category N"
|
||||
);
|
||||
|
||||
$arrayCategory = self::$category->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (CAT_NAME)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "CAT_NAME", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionInvalidDataCatName()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAT_NAME" => ""
|
||||
);
|
||||
|
||||
$arrayCategory = self::$category->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for category name existing
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The category name with CAT_NAME: "PHPUnit My Category 0" already exists.
|
||||
*/
|
||||
public function testCreateExceptionExistsCatName()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAT_NAME" => "PHPUnit My Category 0"
|
||||
);
|
||||
|
||||
$arrayCategory = self::$category->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::update
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testUpdateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayCategory = self::$category->update("", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid category UID
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::update
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The category with CAT_UID: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' does not exist.
|
||||
*/
|
||||
public function testUpdateExceptionInvalidCatUid()
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAT_NAME" => "PHPUnit My Category N"
|
||||
);
|
||||
|
||||
$arrayCategory = self::$category->update("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (CAT_NAME)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the categories
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "CAT_NAME", it can not be empty.
|
||||
*/
|
||||
public function testUpdateExceptionInvalidDataCatName(array $arrayRecord)
|
||||
{
|
||||
$arrayData = array(
|
||||
"CAT_NAME" => ""
|
||||
);
|
||||
|
||||
$arrayCategory = self::$category->update($arrayRecord[0]["CAT_UID"], $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for category name existing
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the categories
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The category name with CAT_NAME: "PHPUnit My Category 0" already exists.
|
||||
*/
|
||||
public function testUpdateExceptionExistsCatName(array $arrayRecord)
|
||||
{
|
||||
$arrayData = $arrayRecord[0];
|
||||
|
||||
$arrayCategory = self::$category->update($arrayRecord[1]["CAT_UID"], $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete categories
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::delete
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the categories
|
||||
*/
|
||||
public function testDelete(array $arrayRecord)
|
||||
{
|
||||
foreach ($arrayRecord as $value) {
|
||||
self::$category->delete($value["CAT_UID"]);
|
||||
}
|
||||
|
||||
$arrayCategory = self::$category->getCategories(array("filter" => "PHPUnit"));
|
||||
|
||||
$this->assertTrue(is_array($arrayCategory));
|
||||
$this->assertEmpty($arrayCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid category UID
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ProcessCategory::delete
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The category with CAT_UID: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' does not exist.
|
||||
*/
|
||||
public function testDeleteExceptionInvalidCatUid()
|
||||
{
|
||||
self::$category->delete("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel\Role;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
require_once(__DIR__ . "/../../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class PermissionTest
|
||||
*
|
||||
* @package Tests\BusinessModel\Role
|
||||
*/
|
||||
class PermissionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $role;
|
||||
protected static $roleUid = "";
|
||||
|
||||
protected static $rolePermission;
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
//Role
|
||||
self::$role = new \ProcessMaker\BusinessModel\Role();
|
||||
|
||||
$arrayData = array(
|
||||
"ROL_CODE" => "PHPUNIT_MY_ROLE_0",
|
||||
"ROL_NAME" => "PHPUnit My Role 0"
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->create($arrayData);
|
||||
|
||||
self::$roleUid = $arrayRole["ROL_UID"];
|
||||
|
||||
//Role and Permission
|
||||
self::$rolePermission = new \ProcessMaker\BusinessModel\Role\Permission();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
self::$role->delete(self::$roleUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test assign permissions to role
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\Permission::create
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$arrayRecord = array();
|
||||
|
||||
//Permission
|
||||
$arrayPermission = self::$rolePermission->getPermissions(self::$roleUid, "AVAILABLE-PERMISSIONS", array("filter" => "V"));
|
||||
|
||||
$this->assertNotEmpty($arrayPermission);
|
||||
|
||||
//Role and Permission - Create
|
||||
foreach ($arrayPermission as $value) {
|
||||
$perUid = $value["PER_UID"];
|
||||
|
||||
$arrayRolePermission = self::$rolePermission->create(self::$roleUid, array("PER_UID" => $perUid));
|
||||
|
||||
$this->assertTrue(is_array($arrayRolePermission));
|
||||
$this->assertNotEmpty($arrayRolePermission);
|
||||
|
||||
$this->assertTrue(isset($arrayRolePermission["ROL_UID"]));
|
||||
|
||||
$arrayRecord[] = $arrayRolePermission;
|
||||
}
|
||||
|
||||
//Return
|
||||
return $arrayRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get assigned permissions to role
|
||||
* Test get available permissions to assign to role
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\Permission::getPermissions
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the role-permission
|
||||
*/
|
||||
public function testGetPermissions(array $arrayRecord)
|
||||
{
|
||||
//PERMISSIONS
|
||||
$arrayPermission = self::$rolePermission->getPermissions(self::$roleUid, "PERMISSIONS");
|
||||
|
||||
$this->assertNotEmpty($arrayPermission);
|
||||
|
||||
$arrayPermission = self::$rolePermission->getPermissions(self::$roleUid, "PERMISSIONS", null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayPermission);
|
||||
|
||||
$arrayPermission = self::$rolePermission->getPermissions(self::$roleUid, "PERMISSIONS", array("filter" => "V"));
|
||||
|
||||
$this->assertTrue(is_array($arrayPermission));
|
||||
$this->assertNotEmpty($arrayPermission);
|
||||
|
||||
$this->assertEquals($arrayPermission[0]["PER_UID"], $arrayRecord[0]["PER_UID"]);
|
||||
|
||||
//AVAILABLE-PERMISSIONS
|
||||
$arrayPermission = self::$rolePermission->getPermissions(self::$roleUid, "AVAILABLE-PERMISSIONS", null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayPermission);
|
||||
|
||||
$arrayPermission = self::$rolePermission->getPermissions(self::$roleUid, "AVAILABLE-PERMISSIONS", array("filter" => "V"));
|
||||
|
||||
$this->assertEmpty($arrayPermission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\Permission::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayRolePermission = self::$rolePermission->create(self::$roleUid, $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid role UID
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\Permission::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The role with ROL_UID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx does not exist.
|
||||
*/
|
||||
public function testCreateExceptionInvalidRolUid()
|
||||
{
|
||||
$arrayData = array(
|
||||
"USR_UID" => "",
|
||||
);
|
||||
|
||||
$arrayRolePermission = self::$rolePermission->create("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (PER_UID)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\Permission::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "PER_UID", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionInvalidDataPerUid()
|
||||
{
|
||||
$arrayData = array(
|
||||
"PER_UID" => "",
|
||||
);
|
||||
|
||||
$arrayRolePermission = self::$rolePermission->create(self::$roleUid, $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test unassign permissions of the role
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\Permission::delete
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the role-permission
|
||||
*/
|
||||
public function testDelete(array $arrayRecord)
|
||||
{
|
||||
foreach ($arrayRecord as $value) {
|
||||
$perUid = $value["PER_UID"];
|
||||
|
||||
self::$rolePermission->delete(self::$roleUid, $perUid);
|
||||
}
|
||||
|
||||
$arrayPermission = self::$rolePermission->getPermissions(self::$roleUid, "PERMISSIONS", array("filter" => "V"));
|
||||
|
||||
$this->assertTrue(is_array($arrayPermission));
|
||||
$this->assertEmpty($arrayPermission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid permission UID
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\Permission::delete
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The permission with PER_UID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx does not exist.
|
||||
*/
|
||||
public function testDeleteExceptionInvalidPerUid()
|
||||
{
|
||||
self::$rolePermission->delete(self::$roleUid, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,225 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel\Role;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
require_once(__DIR__ . "/../../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class UserTest
|
||||
*
|
||||
* @package Tests\BusinessModel\Role
|
||||
*/
|
||||
class UserTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $user;
|
||||
protected static $roleUser;
|
||||
protected static $numUser = 2;
|
||||
protected static $roleUid = "00000000000000000000000000000002"; //PROCESSMAKER_ADMIN
|
||||
|
||||
protected static $arrayUsrUid = array();
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$user = new \ProcessMaker\BusinessModel\User();
|
||||
self::$roleUser = new \ProcessMaker\BusinessModel\Role\User();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
foreach (self::$arrayUsrUid as $value) {
|
||||
$usrUid = $value;
|
||||
|
||||
self::$user->delete($usrUid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test assign users to role
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\User::create
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$arrayRecord = array();
|
||||
|
||||
//User
|
||||
$arrayAux = explode("-", date("Y-m-d"));
|
||||
$dueDate = date("Y-m-d", mktime(0, 0, 0, $arrayAux[1], $arrayAux[2] + 5, $arrayAux[0]));
|
||||
|
||||
for ($i = 0; $i <= self::$numUser - 1; $i++) {
|
||||
$arrayData = array(
|
||||
"USR_USERNAME" => "userphpunit" . $i,
|
||||
"USR_FIRSTNAME" => "userphpunit" . $i,
|
||||
"USR_LASTNAME" => "userphpunit" . $i,
|
||||
"USR_EMAIL" => "userphpunit@email.com" . $i,
|
||||
"USR_COUNTRY" => "",
|
||||
"USR_ADDRESS" => "",
|
||||
"USR_PHONE" => "",
|
||||
"USR_ZIP_CODE" => "",
|
||||
"USR_POSITION" => "",
|
||||
"USR_REPLACED_BY" => "",
|
||||
"USR_DUE_DATE" => $dueDate,
|
||||
"USR_ROLE" => "PROCESSMAKER_OPERATOR",
|
||||
"USR_STATUS" => "ACTIVE",
|
||||
"USR_NEW_PASS" => "userphpunit" . $i,
|
||||
"USR_CNF_PASS" => "userphpunit" . $i
|
||||
);
|
||||
|
||||
$arrayUser = array_change_key_case(self::$user->create($arrayData), CASE_UPPER);
|
||||
|
||||
self::$arrayUsrUid[] = $arrayUser["USR_UID"];
|
||||
$arrayRecord[] = $arrayUser;
|
||||
}
|
||||
|
||||
//Role and User - Create
|
||||
foreach ($arrayRecord as $value) {
|
||||
$usrUid = $value["USR_UID"];
|
||||
|
||||
$arrayRoleUser = self::$roleUser->create(self::$roleUid, array("USR_UID" => $usrUid));
|
||||
|
||||
$this->assertTrue(is_array($arrayRoleUser));
|
||||
$this->assertNotEmpty($arrayRoleUser);
|
||||
|
||||
$this->assertTrue(isset($arrayRoleUser["ROL_UID"]));
|
||||
}
|
||||
|
||||
//Return
|
||||
return $arrayRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get assigned users to role
|
||||
* Test get available users to assign to role
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\User::getUsers
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the users
|
||||
*/
|
||||
public function testGetUsers(array $arrayRecord)
|
||||
{
|
||||
//USERS
|
||||
$arrayUser = self::$roleUser->getUsers(self::$roleUid, "USERS");
|
||||
|
||||
$this->assertNotEmpty($arrayUser);
|
||||
|
||||
$arrayUser = self::$roleUser->getUsers(self::$roleUid, "USERS", null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayUser);
|
||||
|
||||
$arrayUser = self::$roleUser->getUsers(self::$roleUid, "USERS", array("filter" => "userphpunit"));
|
||||
|
||||
$this->assertTrue(is_array($arrayUser));
|
||||
$this->assertNotEmpty($arrayUser);
|
||||
|
||||
$this->assertEquals($arrayUser[0]["USR_UID"], $arrayRecord[0]["USR_UID"]);
|
||||
$this->assertEquals($arrayUser[0]["USR_USERNAME"], $arrayRecord[0]["USR_USERNAME"]);
|
||||
|
||||
//AVAILABLE-USERS
|
||||
$arrayUser = self::$roleUser->getUsers(self::$roleUid, "AVAILABLE-USERS", null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayUser);
|
||||
|
||||
$arrayUser = self::$roleUser->getUsers(self::$roleUid, "AVAILABLE-USERS", array("filter" => "userphpunit"));
|
||||
|
||||
$this->assertEmpty($arrayUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\User::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayRoleUser = self::$roleUser->create(self::$roleUid, $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid role UID
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\User::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The role with ROL_UID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx does not exist.
|
||||
*/
|
||||
public function testCreateExceptionInvalidRolUid()
|
||||
{
|
||||
$arrayData = array(
|
||||
"USR_UID" => "",
|
||||
);
|
||||
|
||||
$arrayRoleUser = self::$roleUser->create("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (USR_UID)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\User::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "USR_UID", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionInvalidDataUsrUid()
|
||||
{
|
||||
$arrayData = array(
|
||||
"USR_UID" => "",
|
||||
);
|
||||
|
||||
$arrayRoleUser = self::$roleUser->create(self::$roleUid, $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test unassign users of the role
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\User::delete
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the users
|
||||
*/
|
||||
public function testDelete(array $arrayRecord)
|
||||
{
|
||||
foreach ($arrayRecord as $value) {
|
||||
$usrUid = $value["USR_UID"];
|
||||
|
||||
self::$roleUser->delete(self::$roleUid, $usrUid);
|
||||
}
|
||||
|
||||
$arrayUser = self::$roleUser->getUsers(self::$roleUid, "USERS", array("filter" => "userphpunit"));
|
||||
|
||||
$this->assertTrue(is_array($arrayUser));
|
||||
$this->assertEmpty($arrayUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for administrator's role can't be changed
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role\User::delete
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The administrator's role can't be changed!
|
||||
*/
|
||||
public function testDeleteExceptionAdminRoleCantChanged()
|
||||
{
|
||||
self::$roleUser->delete(self::$roleUid, "00000000000000000000000000000001");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,330 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
require_once(__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class RoleTest
|
||||
*
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class RoleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $role;
|
||||
protected static $numRole = 2;
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$role = new \ProcessMaker\BusinessModel\Role();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create roles
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::create
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$arrayRecord = array();
|
||||
|
||||
//Create
|
||||
for ($i = 0; $i <= self::$numRole - 1; $i++) {
|
||||
$arrayData = array(
|
||||
"ROL_CODE" => "PHPUNIT_MY_ROLE_" . $i,
|
||||
"ROL_NAME" => "PHPUnit My Role " . $i
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->create($arrayData);
|
||||
|
||||
$this->assertTrue(is_array($arrayRole));
|
||||
$this->assertNotEmpty($arrayRole);
|
||||
|
||||
$this->assertTrue(isset($arrayRole["ROL_UID"]));
|
||||
|
||||
$arrayRecord[] = $arrayRole;
|
||||
}
|
||||
|
||||
//Create - Japanese characters
|
||||
$arrayData = array(
|
||||
"ROL_CODE" => "PHPUNIT_MY_ROLE_" . self::$numRole,
|
||||
"ROL_NAME" => "テスト(PHPUnitの)",
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->create($arrayData);
|
||||
|
||||
$this->assertTrue(is_array($arrayRole));
|
||||
$this->assertNotEmpty($arrayRole);
|
||||
|
||||
$this->assertTrue(isset($arrayRole["ROL_UID"]));
|
||||
|
||||
$arrayRecord[] = $arrayRole;
|
||||
|
||||
//Return
|
||||
return $arrayRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update roles
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the roles
|
||||
*/
|
||||
public function testUpdate(array $arrayRecord)
|
||||
{
|
||||
$arrayData = array("ROL_NAME" => "PHPUnit My Role ...");
|
||||
|
||||
$arrayRole = self::$role->update($arrayRecord[1]["ROL_UID"], $arrayData);
|
||||
|
||||
$arrayRole = self::$role->getRole($arrayRecord[1]["ROL_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayRole));
|
||||
$this->assertNotEmpty($arrayRole);
|
||||
|
||||
$this->assertEquals($arrayRole["ROL_NAME"], $arrayData["ROL_NAME"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get roles
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::getRoles
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the roles
|
||||
*/
|
||||
public function testGetRoles(array $arrayRecord)
|
||||
{
|
||||
$arrayRole = self::$role->getRoles();
|
||||
|
||||
$this->assertNotEmpty($arrayRole);
|
||||
|
||||
$arrayRole = self::$role->getRoles(null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayRole);
|
||||
|
||||
$arrayRole = self::$role->getRoles(array("filter" => "PHPUNIT"));
|
||||
|
||||
$this->assertTrue(is_array($arrayRole));
|
||||
$this->assertNotEmpty($arrayRole);
|
||||
|
||||
$this->assertEquals($arrayRole[0]["ROL_UID"], $arrayRecord[0]["ROL_UID"]);
|
||||
$this->assertEquals($arrayRole[0]["ROL_CODE"], $arrayRecord[0]["ROL_CODE"]);
|
||||
$this->assertEquals($arrayRole[0]["ROL_NAME"], $arrayRecord[0]["ROL_NAME"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get role
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::getRole
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the roles
|
||||
*/
|
||||
public function testGetRole(array $arrayRecord)
|
||||
{
|
||||
//Get
|
||||
$arrayRole = self::$role->getRole($arrayRecord[0]["ROL_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayRole));
|
||||
$this->assertNotEmpty($arrayRole);
|
||||
|
||||
$this->assertEquals($arrayRole["ROL_UID"], $arrayRecord[0]["ROL_UID"]);
|
||||
$this->assertEquals($arrayRole["ROL_CODE"], $arrayRecord[0]["ROL_CODE"]);
|
||||
$this->assertEquals($arrayRole["ROL_NAME"], $arrayRecord[0]["ROL_NAME"]);
|
||||
|
||||
//Get - Japanese characters
|
||||
$arrayRole = self::$role->getRole($arrayRecord[self::$numRole]["ROL_UID"]);
|
||||
|
||||
$this->assertTrue(is_array($arrayRole));
|
||||
$this->assertNotEmpty($arrayRole);
|
||||
|
||||
$this->assertEquals($arrayRole["ROL_UID"], $arrayRecord[self::$numRole]["ROL_UID"]);
|
||||
$this->assertEquals($arrayRole["ROL_CODE"], "PHPUNIT_MY_ROLE_" . self::$numRole);
|
||||
$this->assertEquals($arrayRole["ROL_NAME"], "テスト(PHPUnitの)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayRole = self::$role->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for required data (ROL_CODE)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Undefined value for "ROL_CODE", it is required.
|
||||
*/
|
||||
public function testCreateExceptionRequiredDataRolCode()
|
||||
{
|
||||
$arrayData = array(
|
||||
//"ROL_CODE" => "PHPUNIT_MY_ROLE_N",
|
||||
"ROL_NAME" => "PHPUnit My Role N"
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (ROL_CODE)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "ROL_CODE", it can not be empty.
|
||||
*/
|
||||
public function testCreateExceptionInvalidDataRolCode()
|
||||
{
|
||||
$arrayData = array(
|
||||
"ROL_CODE" => "",
|
||||
"ROL_NAME" => "PHPUnit My Role N"
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for role code existing
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::create
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The role code with ROL_CODE: "PHPUNIT_MY_ROLE_0" already exists.
|
||||
*/
|
||||
public function testCreateExceptionExistsRolCode()
|
||||
{
|
||||
$arrayData = array(
|
||||
"ROL_CODE" => "PHPUNIT_MY_ROLE_0",
|
||||
"ROL_NAME" => "PHPUnit My Role 0"
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->create($arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::update
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testUpdateExceptionEmptyData()
|
||||
{
|
||||
$arrayData = array();
|
||||
|
||||
$arrayRole = self::$role->update("", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid role UID
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::update
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The role with ROL_UID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx does not exist.
|
||||
*/
|
||||
public function testUpdateExceptionInvalidRolUid()
|
||||
{
|
||||
$arrayData = array(
|
||||
"ROL_CODE" => "PHPUNIT_MY_ROLE_N",
|
||||
"ROL_NAME" => "PHPUnit My Role N"
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->update("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid data (ROL_CODE)
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the roles
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "ROL_CODE", it can not be empty.
|
||||
*/
|
||||
public function testUpdateExceptionInvalidDataRolCode(array $arrayRecord)
|
||||
{
|
||||
$arrayData = array(
|
||||
"ROL_CODE" => "",
|
||||
"ROL_NAME" => "PHPUnit My Role 0"
|
||||
);
|
||||
|
||||
$arrayRole = self::$role->update($arrayRecord[0]["ROL_UID"], $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for role code existing
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::update
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the roles
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The role code with ROL_CODE: "PHPUNIT_MY_ROLE_1" already exists.
|
||||
*/
|
||||
public function testUpdateExceptionExistsRolCode(array $arrayRecord)
|
||||
{
|
||||
$arrayData = $arrayRecord[1];
|
||||
|
||||
$arrayRole = self::$role->update($arrayRecord[0]["ROL_UID"], $arrayData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete roles
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::delete
|
||||
*
|
||||
* @depends testCreate
|
||||
* @param array $arrayRecord Data of the roles
|
||||
*/
|
||||
public function testDelete(array $arrayRecord)
|
||||
{
|
||||
foreach ($arrayRecord as $value) {
|
||||
self::$role->delete($value["ROL_UID"]);
|
||||
}
|
||||
|
||||
$arrayRole = self::$role->getRoles(array("filter" => "PHPUNIT"));
|
||||
|
||||
$this->assertTrue(is_array($arrayRole));
|
||||
$this->assertEmpty($arrayRole);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for role UID that cannot be deleted
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Role::delete
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage This role cannot be deleted while it still has some assigned users.
|
||||
*/
|
||||
public function testDeleteExceptionCannotDeleted()
|
||||
{
|
||||
self::$role->delete("00000000000000000000000000000002");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,315 +0,0 @@
|
||||
<?php
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../bootstrap.php";
|
||||
}
|
||||
|
||||
use \BpmnActivity;
|
||||
|
||||
/**
|
||||
* Class BpmnActivityTest
|
||||
*
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class BpmnActivityTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $prjUid = "00000000000000000000000000000001";
|
||||
protected static $diaUid = "18171550f1198ddc8642045664020352";
|
||||
protected static $proUid = "155064020352f1198ddc864204561817";
|
||||
|
||||
protected static $data1;
|
||||
protected static $data2;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$project = new \BpmnProject();
|
||||
$project->setPrjUid(self::$prjUid);
|
||||
$project->setPrjName("Dummy Project");
|
||||
$project->save();
|
||||
|
||||
$process = new \BpmnDiagram();
|
||||
$process->setDiaUid(self::$diaUid);
|
||||
$process->setPrjUid(self::$prjUid);
|
||||
$process->save();
|
||||
|
||||
$process = new \BpmnProcess();
|
||||
$process->setProUid(self::$proUid);
|
||||
$process->setPrjUid(self::$prjUid);
|
||||
$process->setDiaUid(self::$diaUid);
|
||||
$process->save();
|
||||
|
||||
self::$data1 = array(
|
||||
"ACT_UID" => "864215906402045618170352f1198ddc",
|
||||
"PRJ_UID" => self::$prjUid,
|
||||
"PRO_UID" => self::$proUid,
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => "51",
|
||||
"BOU_Y" => "52"
|
||||
);
|
||||
|
||||
self::$data2 = array(
|
||||
"ACT_UID" => "70352f1198ddc8642159064020456181",
|
||||
"PRJ_UID" => self::$prjUid,
|
||||
"PRO_UID" => self::$proUid,
|
||||
"ACT_NAME" => "Activity #2",
|
||||
"BOU_X" => "53",
|
||||
"BOU_Y" => "54"
|
||||
);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$activities = BpmnActivity::findAllBy(BpmnActivityPeer::PRJ_UID, self::$prjUid);
|
||||
foreach ($activities as $activity) {
|
||||
$activity->delete();
|
||||
}
|
||||
|
||||
$bounds = BpmnBound::findAllBy(BpmnBoundPeer::PRJ_UID, self::$prjUid);
|
||||
foreach ($bounds as $bound) {
|
||||
$bound->delete();
|
||||
}
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK(self::$proUid);
|
||||
$process->delete();
|
||||
|
||||
$diagram = BpmnDiagramPeer::retrieveByPK(self::$diaUid);
|
||||
$diagram->delete();
|
||||
|
||||
$project = BpmnProjectPeer::retrieveByPK(self::$prjUid);
|
||||
$project->delete();
|
||||
}
|
||||
|
||||
public function testNew()
|
||||
{
|
||||
$activity = new BpmnActivity();
|
||||
$activity->setActUid(self::$data1["ACT_UID"]);
|
||||
$activity->setPrjUid(self::$data1["PRJ_UID"]);
|
||||
$activity->setProUid(self::$data1["PRO_UID"]);
|
||||
$activity->setActName(self::$data1["ACT_NAME"]);
|
||||
$activity->getBound()->setBouX(self::$data1["BOU_X"]);
|
||||
$activity->getBound()->setBouY(self::$data1["BOU_Y"]);
|
||||
$activity->save();
|
||||
|
||||
$activity2 = BpmnActivityPeer::retrieveByPK($activity->getActUid());
|
||||
|
||||
$this->assertNotNull($activity2);
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
public function testNewUsingFromArray()
|
||||
{
|
||||
$activity = new BpmnActivity();
|
||||
$activity->fromArray(self::$data2);
|
||||
|
||||
$activity->save();
|
||||
|
||||
$activity2 = BpmnActivityPeer::retrieveByPK($activity->getActUid());
|
||||
|
||||
$this->assertNotNull($activity2);
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param $activity \BpmnActivity
|
||||
*/
|
||||
public function testToArrayFromTestNew($activity)
|
||||
{
|
||||
$expected = array(
|
||||
"ACT_UID" => self::$data1["ACT_UID"],
|
||||
"PRJ_UID" => self::$data1["PRJ_UID"],
|
||||
"PRO_UID" => self::$data1["PRO_UID"],
|
||||
"ACT_NAME" => self::$data1["ACT_NAME"],
|
||||
"ACT_TYPE" => "TASK",
|
||||
"ACT_IS_FOR_COMPENSATION" => "0",
|
||||
"ACT_START_QUANTITY" => "1",
|
||||
"ACT_COMPLETION_QUANTITY" => "1",
|
||||
"ACT_TASK_TYPE" => "EMPTY",
|
||||
"ACT_IMPLEMENTATION" => "",
|
||||
"ACT_INSTANTIATE" => "0",
|
||||
"ACT_SCRIPT_TYPE" => "",
|
||||
"ACT_SCRIPT" => "",
|
||||
"ACT_LOOP_TYPE" => "NONE",
|
||||
"ACT_TEST_BEFORE" => "0",
|
||||
"ACT_LOOP_MAXIMUM" => "0",
|
||||
"ACT_LOOP_CONDITION" => "",
|
||||
"ACT_LOOP_CARDINALITY" => "0",
|
||||
"ACT_LOOP_BEHAVIOR" => "NONE",
|
||||
"ACT_IS_ADHOC" => "0",
|
||||
"ACT_IS_COLLAPSED" => "1",
|
||||
"ACT_COMPLETION_CONDITION" => "",
|
||||
"ACT_ORDERING" => "PARALLEL",
|
||||
"ACT_CANCEL_REMAINING_INSTANCES" => "1",
|
||||
"ACT_PROTOCOL" => "",
|
||||
"ACT_METHOD" => "",
|
||||
"ACT_IS_GLOBAL" => "0",
|
||||
"ACT_REFERER" => "",
|
||||
"ACT_DEFAULT_FLOW" => "",
|
||||
"ACT_MASTER_DIAGRAM" => "",
|
||||
"DIA_UID" => self::$diaUid,
|
||||
"ELEMENT_UID" => self::$data1["ACT_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnActivity",
|
||||
"BOU_X" => self::$data1["BOU_X"],
|
||||
"BOU_Y" => self::$data1["BOU_Y"],
|
||||
"BOU_WIDTH" => "0",
|
||||
"BOU_HEIGHT" => "0",
|
||||
"BOU_REL_POSITION" => "0",
|
||||
"BOU_SIZE_IDENTICAL" => "0",
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $activity->toArray();
|
||||
$bouUid = $result["BOU_UID"];
|
||||
|
||||
$this->assertNotEmpty($bouUid);
|
||||
$this->assertEquals(32, strlen($bouUid));
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNewUsingFromArray
|
||||
*/
|
||||
public function testToArrayFromTestNewUsingFromArray($activity)
|
||||
{
|
||||
$expected = array(
|
||||
"ACT_UID" => self::$data2["ACT_UID"],
|
||||
"PRJ_UID" => self::$data2["PRJ_UID"],
|
||||
"PRO_UID" => self::$data2["PRO_UID"],
|
||||
"ACT_NAME" => self::$data2["ACT_NAME"],
|
||||
"ACT_TYPE" => "TASK",
|
||||
"ACT_IS_FOR_COMPENSATION" => "0",
|
||||
"ACT_START_QUANTITY" => "1",
|
||||
"ACT_COMPLETION_QUANTITY" => "1",
|
||||
"ACT_TASK_TYPE" => "EMPTY",
|
||||
"ACT_IMPLEMENTATION" => "",
|
||||
"ACT_INSTANTIATE" => "0",
|
||||
"ACT_SCRIPT_TYPE" => "",
|
||||
"ACT_SCRIPT" => "",
|
||||
"ACT_LOOP_TYPE" => "NONE",
|
||||
"ACT_TEST_BEFORE" => "0",
|
||||
"ACT_LOOP_MAXIMUM" => "0",
|
||||
"ACT_LOOP_CONDITION" => "",
|
||||
"ACT_LOOP_CARDINALITY" => "0",
|
||||
"ACT_LOOP_BEHAVIOR" => "NONE",
|
||||
"ACT_IS_ADHOC" => "0",
|
||||
"ACT_IS_COLLAPSED" => "1",
|
||||
"ACT_COMPLETION_CONDITION" => "",
|
||||
"ACT_ORDERING" => "PARALLEL",
|
||||
"ACT_CANCEL_REMAINING_INSTANCES" => "1",
|
||||
"ACT_PROTOCOL" => "",
|
||||
"ACT_METHOD" => "",
|
||||
"ACT_IS_GLOBAL" => "0",
|
||||
"ACT_REFERER" => "",
|
||||
"ACT_DEFAULT_FLOW" => "",
|
||||
"ACT_MASTER_DIAGRAM" => "",
|
||||
"DIA_UID" => "18171550f1198ddc8642045664020352",
|
||||
"ELEMENT_UID" => self::$data2["ACT_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnActivity",
|
||||
"BOU_X" => self::$data2["BOU_X"],
|
||||
"BOU_Y" => self::$data2["BOU_Y"],
|
||||
"BOU_WIDTH" => "0",
|
||||
"BOU_HEIGHT" => "0",
|
||||
"BOU_REL_POSITION" => "0",
|
||||
"BOU_SIZE_IDENTICAL" => "0",
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $activity->toArray();
|
||||
$bouUid = $result["BOU_UID"];
|
||||
|
||||
$this->assertNotEmpty($bouUid);
|
||||
$this->assertEquals(32, strlen($bouUid));
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function testToArray()
|
||||
{
|
||||
$activity = BpmnActivityPeer::retrieveByPK(self::$data1["ACT_UID"]);
|
||||
|
||||
$expected = array(
|
||||
"ACT_UID" => self::$data1["ACT_UID"],
|
||||
"PRJ_UID" => self::$data1["PRJ_UID"],
|
||||
"PRO_UID" => self::$data1["PRO_UID"],
|
||||
"ACT_NAME" => self::$data1["ACT_NAME"],
|
||||
"ACT_TYPE" => "TASK",
|
||||
"ACT_IS_FOR_COMPENSATION" => "0",
|
||||
"ACT_START_QUANTITY" => "1",
|
||||
"ACT_COMPLETION_QUANTITY" => "1",
|
||||
"ACT_TASK_TYPE" => "EMPTY",
|
||||
"ACT_IMPLEMENTATION" => "",
|
||||
"ACT_INSTANTIATE" => "0",
|
||||
"ACT_SCRIPT_TYPE" => "",
|
||||
"ACT_SCRIPT" => "",
|
||||
"ACT_LOOP_TYPE" => "NONE",
|
||||
"ACT_TEST_BEFORE" => "0",
|
||||
"ACT_LOOP_MAXIMUM" => "0",
|
||||
"ACT_LOOP_CONDITION" => "",
|
||||
"ACT_LOOP_CARDINALITY" => "0",
|
||||
"ACT_LOOP_BEHAVIOR" => "NONE",
|
||||
"ACT_IS_ADHOC" => "0",
|
||||
"ACT_IS_COLLAPSED" => "1",
|
||||
"ACT_COMPLETION_CONDITION" => "",
|
||||
"ACT_ORDERING" => "PARALLEL",
|
||||
"ACT_CANCEL_REMAINING_INSTANCES" => "1",
|
||||
"ACT_PROTOCOL" => "",
|
||||
"ACT_METHOD" => "",
|
||||
"ACT_IS_GLOBAL" => "0",
|
||||
"ACT_REFERER" => "",
|
||||
"ACT_DEFAULT_FLOW" => "",
|
||||
"ACT_MASTER_DIAGRAM" => "",
|
||||
"DIA_UID" => "18171550f1198ddc8642045664020352",
|
||||
"ELEMENT_UID" => self::$data1["ACT_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnActivity",
|
||||
"BOU_X" => self::$data1["BOU_X"],
|
||||
"BOU_Y" => self::$data1["BOU_Y"],
|
||||
"BOU_WIDTH" => "0",
|
||||
"BOU_HEIGHT" => "0",
|
||||
"BOU_REL_POSITION" => "0",
|
||||
"BOU_SIZE_IDENTICAL" => "0",
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $activity->toArray();
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testNewUsingFromArray
|
||||
* @param $activity1 \BpmnActivity
|
||||
* @param $activity2 \BpmnActivity
|
||||
*/
|
||||
public function testDelete($activity1, $activity2)
|
||||
{
|
||||
$actUid = $activity1->getActUid();
|
||||
$activity = BpmnActivityPeer::retrieveByPK($actUid);
|
||||
$activity->delete();
|
||||
|
||||
$this->assertNull(BpmnActivityPeer::retrieveByPK($actUid));
|
||||
// the previous call must delete the bound object related to activity too.
|
||||
$this->assertNull(BpmnBound::findByElement("Activity", $actUid));
|
||||
|
||||
|
||||
$actUid = $activity2->getActUid();
|
||||
$activity = BpmnActivityPeer::retrieveByPK($actUid);
|
||||
$activity->delete();
|
||||
|
||||
$this->assertNull(BpmnActivityPeer::retrieveByPK($actUid));
|
||||
// the previous call must delete the bound object related to activity too.
|
||||
$this->assertNull(BpmnBound::findByElement("Activity", $actUid));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,297 +0,0 @@
|
||||
<?php
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../bootstrap.php";
|
||||
}
|
||||
|
||||
use \BpmnEvent;
|
||||
|
||||
/**
|
||||
* Class BpmnEventTest
|
||||
*
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class BpmnEventTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $prjUid = "00000000000000000000000000000001";
|
||||
protected static $diaUid = "18171550f1198ddc8642045664020352";
|
||||
protected static $proUid = "155064020352f1198ddc864204561817";
|
||||
|
||||
protected static $data1;
|
||||
protected static $data2;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$project = new \BpmnProject();
|
||||
$project->setPrjUid(self::$prjUid);
|
||||
$project->setPrjName("Dummy Project");
|
||||
$project->save();
|
||||
|
||||
$process = new \BpmnDiagram();
|
||||
$process->setDiaUid(self::$diaUid);
|
||||
$process->setPrjUid(self::$prjUid);
|
||||
$process->save();
|
||||
|
||||
$process = new \BpmnProcess();
|
||||
$process->setProUid(self::$proUid);
|
||||
$process->setPrjUid(self::$prjUid);
|
||||
$process->setDiaUid(self::$diaUid);
|
||||
$process->save();
|
||||
|
||||
self::$data1 = array(
|
||||
"EVN_UID" => "864215906402045618170352f1198ddc",
|
||||
"PRJ_UID" => self::$prjUid,
|
||||
"PRO_UID" => self::$proUid,
|
||||
"EVN_NAME" => "Event #1",
|
||||
"EVN_TYPE" => "START",
|
||||
"BOU_X" => 51,
|
||||
"BOU_Y" => 52
|
||||
);
|
||||
|
||||
self::$data2 = array(
|
||||
"EVN_UID" => "70352f1198ddc8642159064020456181",
|
||||
"PRJ_UID" => self::$prjUid,
|
||||
"PRO_UID" => self::$proUid,
|
||||
"EVN_NAME" => "Event #2",
|
||||
"EVN_TYPE" => "END",
|
||||
"BOU_X" => 53,
|
||||
"BOU_Y" => 54
|
||||
);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$events = BpmnEvent::findAllBy(BpmnEventPeer::PRJ_UID, self::$prjUid);
|
||||
foreach ($events as $event) {
|
||||
$event->delete();
|
||||
}
|
||||
|
||||
$bounds = BpmnBound::findAllBy(BpmnBoundPeer::PRJ_UID, self::$prjUid);
|
||||
foreach ($bounds as $bound) {
|
||||
$bound->delete();
|
||||
}
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK(self::$proUid);
|
||||
$process->delete();
|
||||
|
||||
$diagram = BpmnDiagramPeer::retrieveByPK(self::$diaUid);
|
||||
$diagram->delete();
|
||||
|
||||
$project = BpmnProjectPeer::retrieveByPK(self::$prjUid);
|
||||
$project->delete();
|
||||
}
|
||||
|
||||
public function testNew()
|
||||
{
|
||||
$event = new BpmnEvent();
|
||||
$event->setEvnUid(self::$data1["EVN_UID"]);
|
||||
$event->setPrjUid(self::$data1["PRJ_UID"]);
|
||||
$event->setProUid(self::$data1["PRO_UID"]);
|
||||
$event->setEvnName(self::$data1["EVN_NAME"]);
|
||||
$event->setEvnType(self::$data1["EVN_TYPE"]);
|
||||
$event->getBound()->setBouX(self::$data1["BOU_X"]);
|
||||
$event->getBound()->setBouY(self::$data1["BOU_Y"]);
|
||||
$event->save();
|
||||
|
||||
$event2 = BpmnEventPeer::retrieveByPK($event->getEvnUid());
|
||||
|
||||
$this->assertNotNull($event2);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
public function testNewUsingFromArray()
|
||||
{
|
||||
$event = new BpmnEvent();
|
||||
$event->fromArray(self::$data2);
|
||||
$event->save();
|
||||
|
||||
$event2 = BpmnEventPeer::retrieveByPK($event->getEvnUid());
|
||||
|
||||
$this->assertNotNull($event2);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param $event \BpmnEvent
|
||||
*/
|
||||
public function testToArrayFromTestNew($event)
|
||||
{
|
||||
$expected = array(
|
||||
"EVN_UID" => self::$data1["EVN_UID"],
|
||||
"PRJ_UID" => self::$data1["PRJ_UID"],
|
||||
"PRO_UID" => self::$data1["PRO_UID"],
|
||||
"EVN_NAME" => self::$data1["EVN_NAME"],
|
||||
"EVN_TYPE" => self::$data1["EVN_TYPE"],
|
||||
"EVN_MARKER" => "EMPTY",
|
||||
"EVN_IS_INTERRUPTING" => 1,
|
||||
"EVN_ATTACHED_TO" => "",
|
||||
"EVN_CANCEL_ACTIVITY" => 0,
|
||||
"EVN_ACTIVITY_REF" => "",
|
||||
"EVN_WAIT_FOR_COMPLETION" => 1,
|
||||
"EVN_ERROR_NAME" => null,
|
||||
"EVN_ERROR_CODE" => null,
|
||||
"EVN_ESCALATION_NAME" => null,
|
||||
"EVN_ESCALATION_CODE" => null,
|
||||
"EVN_CONDITION" => null,
|
||||
"EVN_MESSAGE" => null,
|
||||
"EVN_OPERATION_NAME" => null,
|
||||
"EVN_OPERATION_IMPLEMENTATION_REF" => null,
|
||||
"EVN_TIME_DATE" => null,
|
||||
"EVN_TIME_CYCLE" => null,
|
||||
"EVN_TIME_DURATION" => null,
|
||||
"EVN_BEHAVIOR" => "CATCH",
|
||||
"DIA_UID" => self::$diaUid,
|
||||
"ELEMENT_UID" => self::$data1["EVN_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnEvent",
|
||||
"BOU_X" => self::$data1["BOU_X"],
|
||||
"BOU_Y" => self::$data1["BOU_Y"],
|
||||
"BOU_WIDTH" => 0,
|
||||
"BOU_HEIGHT" => 0,
|
||||
"BOU_REL_POSITION" => 0,
|
||||
"BOU_SIZE_IDENTICAL" => 0,
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $event->toArray();
|
||||
$bouUid = $result["BOU_UID"];
|
||||
|
||||
$this->assertNotEmpty($bouUid);
|
||||
$this->assertEquals(32, strlen($bouUid));
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNewUsingFromArray
|
||||
* @param $event \BpmnEvent
|
||||
*/
|
||||
public function testToArrayFromTestNewUsingFromArray($event)
|
||||
{
|
||||
$expected = array(
|
||||
"EVN_UID" => self::$data2["EVN_UID"],
|
||||
"PRJ_UID" => self::$data2["PRJ_UID"],
|
||||
"PRO_UID" => self::$data2["PRO_UID"],
|
||||
"EVN_NAME" => self::$data2["EVN_NAME"],
|
||||
"EVN_TYPE" => self::$data2["EVN_TYPE"],
|
||||
"EVN_MARKER" => "EMPTY",
|
||||
"EVN_IS_INTERRUPTING" => 1,
|
||||
"EVN_ATTACHED_TO" => "",
|
||||
"EVN_CANCEL_ACTIVITY" => 0,
|
||||
"EVN_ACTIVITY_REF" => "",
|
||||
"EVN_WAIT_FOR_COMPLETION" => 1,
|
||||
"EVN_ERROR_NAME" => null,
|
||||
"EVN_ERROR_CODE" => null,
|
||||
"EVN_ESCALATION_NAME" => null,
|
||||
"EVN_ESCALATION_CODE" => null,
|
||||
"EVN_CONDITION" => null,
|
||||
"EVN_MESSAGE" => null,
|
||||
"EVN_OPERATION_NAME" => null,
|
||||
"EVN_OPERATION_IMPLEMENTATION_REF" => null,
|
||||
"EVN_TIME_DATE" => null,
|
||||
"EVN_TIME_CYCLE" => null,
|
||||
"EVN_TIME_DURATION" => null,
|
||||
"EVN_BEHAVIOR" => "CATCH",
|
||||
"DIA_UID" => self::$diaUid,
|
||||
"ELEMENT_UID" => self::$data2["EVN_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnEvent",
|
||||
"BOU_X" => self::$data2["BOU_X"],
|
||||
"BOU_Y" => self::$data2["BOU_Y"],
|
||||
"BOU_WIDTH" => 0,
|
||||
"BOU_HEIGHT" => 0,
|
||||
"BOU_REL_POSITION" => 0,
|
||||
"BOU_SIZE_IDENTICAL" => 0,
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $event->toArray();
|
||||
$bouUid = $result["BOU_UID"];
|
||||
|
||||
$this->assertNotEmpty($bouUid);
|
||||
$this->assertEquals(32, strlen($bouUid));
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function testToArray()
|
||||
{
|
||||
$event = BpmnEventPeer::retrieveByPK(self::$data1["EVN_UID"]);
|
||||
|
||||
$expected = array(
|
||||
"EVN_UID" => self::$data1["EVN_UID"],
|
||||
"PRJ_UID" => self::$data1["PRJ_UID"],
|
||||
"PRO_UID" => self::$data1["PRO_UID"],
|
||||
"EVN_NAME" => self::$data1["EVN_NAME"],
|
||||
"EVN_TYPE" => self::$data1["EVN_TYPE"],
|
||||
"EVN_MARKER" => "EMPTY",
|
||||
"EVN_IS_INTERRUPTING" => 1,
|
||||
"EVN_ATTACHED_TO" => "",
|
||||
"EVN_CANCEL_ACTIVITY" => 0,
|
||||
"EVN_ACTIVITY_REF" => "",
|
||||
"EVN_WAIT_FOR_COMPLETION" => 1,
|
||||
"EVN_ERROR_NAME" => null,
|
||||
"EVN_ERROR_CODE" => null,
|
||||
"EVN_ESCALATION_NAME" => null,
|
||||
"EVN_ESCALATION_CODE" => null,
|
||||
"EVN_CONDITION" => null,
|
||||
"EVN_MESSAGE" => null,
|
||||
"EVN_OPERATION_NAME" => null,
|
||||
"EVN_OPERATION_IMPLEMENTATION_REF" => null,
|
||||
"EVN_TIME_DATE" => null,
|
||||
"EVN_TIME_CYCLE" => null,
|
||||
"EVN_TIME_DURATION" => null,
|
||||
"EVN_BEHAVIOR" => "CATCH",
|
||||
"DIA_UID" => self::$diaUid,
|
||||
"ELEMENT_UID" => self::$data1["EVN_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnEvent",
|
||||
"BOU_X" => self::$data1["BOU_X"],
|
||||
"BOU_Y" => self::$data1["BOU_Y"],
|
||||
"BOU_WIDTH" => 0,
|
||||
"BOU_HEIGHT" => 0,
|
||||
"BOU_REL_POSITION" => 0,
|
||||
"BOU_SIZE_IDENTICAL" => 0,
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $event->toArray();
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testNewUsingFromArray
|
||||
* @param $event1 \BpmnEvent
|
||||
* @param $event2 \BpmnEvent
|
||||
*/
|
||||
public function testDelete($event1, $event2)
|
||||
{
|
||||
$gatUid = $event1->getEvnUid();
|
||||
$event = BpmnEventPeer::retrieveByPK($gatUid);
|
||||
$event->delete();
|
||||
|
||||
$this->assertNull(BpmnEventPeer::retrieveByPK($gatUid));
|
||||
// the previous call must delete the bound object related to activity too.
|
||||
$this->assertNull(BpmnBound::findByElement("Event", $gatUid));
|
||||
|
||||
|
||||
$gatUid = $event2->getEvnUid();
|
||||
$event = BpmnEventPeer::retrieveByPK($gatUid);
|
||||
$event->delete();
|
||||
|
||||
$this->assertNull(BpmnEventPeer::retrieveByPK($gatUid));
|
||||
// the previous call must delete the bound object related to activity too.
|
||||
$this->assertNull(BpmnBound::findByElement("Event", $gatUid));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
<?php
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../bootstrap.php";
|
||||
}
|
||||
|
||||
use \BpmnGateway;
|
||||
|
||||
|
||||
/**
|
||||
* Class BpmnGatewayTest
|
||||
*
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class BpmnGatewayTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $prjUid = "00000000000000000000000000000001";
|
||||
protected static $diaUid = "18171550f1198ddc8642045664020352";
|
||||
protected static $proUid = "155064020352f1198ddc864204561817";
|
||||
|
||||
protected static $data1;
|
||||
protected static $data2;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$project = new \BpmnProject();
|
||||
$project->setPrjUid(self::$prjUid);
|
||||
$project->setPrjName("Dummy Project");
|
||||
$project->save();
|
||||
|
||||
$process = new \BpmnDiagram();
|
||||
$process->setDiaUid(self::$diaUid);
|
||||
$process->setPrjUid(self::$prjUid);
|
||||
$process->save();
|
||||
|
||||
$process = new \BpmnProcess();
|
||||
$process->setProUid(self::$proUid);
|
||||
$process->setPrjUid(self::$prjUid);
|
||||
$process->setDiaUid(self::$diaUid);
|
||||
$process->save();
|
||||
|
||||
self::$data1 = array(
|
||||
"GAT_UID" => "864215906402045618170352f1198ddc",
|
||||
"PRJ_UID" => self::$prjUid,
|
||||
"PRO_UID" => self::$proUid,
|
||||
"GAT_NAME" => "Gateway #1",
|
||||
"GAT_TYPE" => "SELECTION",
|
||||
"BOU_X" => 51,
|
||||
"BOU_Y" => 52
|
||||
);
|
||||
|
||||
self::$data2 = array(
|
||||
"GAT_UID" => "70352f1198ddc8642159064020456181",
|
||||
"PRJ_UID" => self::$prjUid,
|
||||
"PRO_UID" => self::$proUid,
|
||||
"GAT_NAME" => "Gateway #2",
|
||||
"GAT_TYPE" => "EVALUATION",
|
||||
"BOU_X" => 53,
|
||||
"BOU_Y" => 54
|
||||
);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$gateways = BpmnGateway::findAllBy(BpmnGatewayPeer::PRJ_UID, self::$prjUid);
|
||||
foreach ($gateways as $gateway) {
|
||||
$gateway->delete();
|
||||
}
|
||||
|
||||
$bounds = BpmnBound::findAllBy(BpmnBoundPeer::PRJ_UID, self::$prjUid);
|
||||
foreach ($bounds as $bound) {
|
||||
$bound->delete();
|
||||
}
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK(self::$proUid);
|
||||
$process->delete();
|
||||
|
||||
$diagram = BpmnDiagramPeer::retrieveByPK(self::$diaUid);
|
||||
$diagram->delete();
|
||||
|
||||
$project = BpmnProjectPeer::retrieveByPK(self::$prjUid);
|
||||
$project->delete();
|
||||
}
|
||||
|
||||
public function testNew()
|
||||
{
|
||||
$gateway = new BpmnGateway();
|
||||
$gateway->setGatUid(self::$data1["GAT_UID"]);
|
||||
$gateway->setPrjUid(self::$data1["PRJ_UID"]);
|
||||
$gateway->setProUid(self::$data1["PRO_UID"]);
|
||||
$gateway->setGatName(self::$data1["GAT_NAME"]);
|
||||
$gateway->setGatType(self::$data1["GAT_TYPE"]);
|
||||
$gateway->getBound()->setBouX(self::$data1["BOU_X"]);
|
||||
$gateway->getBound()->setBouY(self::$data1["BOU_Y"]);
|
||||
$gateway->save();
|
||||
|
||||
$gateway2 = BpmnGatewayPeer::retrieveByPK($gateway->getGatUid());
|
||||
|
||||
$this->assertNotNull($gateway2);
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
public function testNewUsingFromArray()
|
||||
{
|
||||
$gateway = new BpmnGateway();
|
||||
$gateway->fromArray(self::$data2);
|
||||
$gateway->save();
|
||||
|
||||
$gateway2 = BpmnGatewayPeer::retrieveByPK($gateway->getGatUid());
|
||||
|
||||
$this->assertNotNull($gateway2);
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param $gateway \BpmnGateway
|
||||
*/
|
||||
public function testToArrayFromTestNew($gateway)
|
||||
{
|
||||
$expected = array(
|
||||
"GAT_UID" => self::$data1["GAT_UID"],
|
||||
"PRJ_UID" => self::$data1["PRJ_UID"],
|
||||
"PRO_UID" => self::$data1["PRO_UID"],
|
||||
"GAT_NAME" => self::$data1["GAT_NAME"],
|
||||
"GAT_TYPE" => self::$data1["GAT_TYPE"],
|
||||
"GAT_DIRECTION" => "UNSPECIFIED",
|
||||
"GAT_INSTANTIATE" => 0,
|
||||
"GAT_EVENT_GATEWAY_TYPE" => 'NONE',
|
||||
"GAT_ACTIVATION_COUNT" => 0,
|
||||
"GAT_WAITING_FOR_START" => 1,
|
||||
"GAT_DEFAULT_FLOW" => "",
|
||||
"DIA_UID" => self::$diaUid,
|
||||
"ELEMENT_UID" => self::$data1["GAT_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnGateway",
|
||||
"BOU_X" => self::$data1["BOU_X"],
|
||||
"BOU_Y" => self::$data1["BOU_Y"],
|
||||
"BOU_WIDTH" => 0,
|
||||
"BOU_HEIGHT" => 0,
|
||||
"BOU_REL_POSITION" => 0,
|
||||
"BOU_SIZE_IDENTICAL" => 0,
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $gateway->toArray();
|
||||
$bouUid = $result["BOU_UID"];
|
||||
|
||||
$this->assertNotEmpty($bouUid);
|
||||
$this->assertEquals(32, strlen($bouUid));
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNewUsingFromArray
|
||||
* @param $gateway \BpmnGateway
|
||||
*/
|
||||
public function testToArrayFromTestNewUsingFromArray($gateway)
|
||||
{
|
||||
$expected = array(
|
||||
"GAT_UID" => self::$data2["GAT_UID"],
|
||||
"PRJ_UID" => self::$data2["PRJ_UID"],
|
||||
"PRO_UID" => self::$data2["PRO_UID"],
|
||||
"GAT_NAME" => self::$data2["GAT_NAME"],
|
||||
"GAT_TYPE" => self::$data2["GAT_TYPE"],
|
||||
"GAT_DIRECTION" => "UNSPECIFIED",
|
||||
"GAT_INSTANTIATE" => 0,
|
||||
"GAT_EVENT_GATEWAY_TYPE" => 'NONE',
|
||||
"GAT_ACTIVATION_COUNT" => 0,
|
||||
"GAT_WAITING_FOR_START" => 1,
|
||||
"GAT_DEFAULT_FLOW" => "",
|
||||
"DIA_UID" => self::$diaUid,
|
||||
"ELEMENT_UID" => self::$data2["GAT_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnGateway",
|
||||
"BOU_X" => self::$data2["BOU_X"],
|
||||
"BOU_Y" => self::$data2["BOU_Y"],
|
||||
"BOU_WIDTH" => 0,
|
||||
"BOU_HEIGHT" => 0,
|
||||
"BOU_REL_POSITION" => 0,
|
||||
"BOU_SIZE_IDENTICAL" => 0,
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $gateway->toArray();
|
||||
$bouUid = $result["BOU_UID"];
|
||||
|
||||
$this->assertNotEmpty($bouUid);
|
||||
$this->assertEquals(32, strlen($bouUid));
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function testToArray()
|
||||
{
|
||||
$gateway = BpmnGatewayPeer::retrieveByPK(self::$data1["GAT_UID"]);
|
||||
|
||||
$expected = array(
|
||||
"GAT_UID" => self::$data1["GAT_UID"],
|
||||
"PRJ_UID" => self::$data1["PRJ_UID"],
|
||||
"PRO_UID" => self::$data1["PRO_UID"],
|
||||
"GAT_NAME" => self::$data1["GAT_NAME"],
|
||||
"GAT_TYPE" => self::$data1["GAT_TYPE"],
|
||||
"GAT_DIRECTION" => "UNSPECIFIED",
|
||||
"GAT_INSTANTIATE" => 0,
|
||||
"GAT_EVENT_GATEWAY_TYPE" => 'NONE',
|
||||
"GAT_ACTIVATION_COUNT" => 0,
|
||||
"GAT_WAITING_FOR_START" => 1,
|
||||
"GAT_DEFAULT_FLOW" => "",
|
||||
"DIA_UID" => self::$diaUid,
|
||||
"ELEMENT_UID" => self::$data1["GAT_UID"],
|
||||
"BOU_ELEMENT" => "pm_canvas",
|
||||
"BOU_ELEMENT_TYPE" => "bpmnGateway",
|
||||
"BOU_X" => self::$data1["BOU_X"],
|
||||
"BOU_Y" => self::$data1["BOU_Y"],
|
||||
"BOU_WIDTH" => 0,
|
||||
"BOU_HEIGHT" => 0,
|
||||
"BOU_REL_POSITION" => 0,
|
||||
"BOU_SIZE_IDENTICAL" => 0,
|
||||
"BOU_CONTAINER" => "bpmnDiagram"
|
||||
);
|
||||
|
||||
$result = $gateway->toArray();
|
||||
|
||||
unset($result["BOU_UID"]);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testNewUsingFromArray
|
||||
* @param $gateway1 \BpmnGateway
|
||||
* @param $gateway2 \BpmnGateway
|
||||
*/
|
||||
public function testDelete($gateway1, $gateway2)
|
||||
{
|
||||
$gatUid = $gateway1->getGatUid();
|
||||
$gateway = BpmnGatewayPeer::retrieveByPK($gatUid);
|
||||
$gateway->delete();
|
||||
|
||||
$this->assertNull(BpmnGatewayPeer::retrieveByPK($gatUid));
|
||||
// the previous call must delete the bound object related to activity too.
|
||||
$this->assertNull(BpmnBound::findByElement("Gateway", $gatUid));
|
||||
|
||||
|
||||
$gatUid = $gateway2->getGatUid();
|
||||
$gateway = BpmnGatewayPeer::retrieveByPK($gatUid);
|
||||
$gateway->delete();
|
||||
|
||||
$this->assertNull(BpmnGatewayPeer::retrieveByPK($gatUid));
|
||||
// the previous call must delete the bound object related to activity too.
|
||||
$this->assertNull(BpmnBound::findByElement("Gateway", $gatUid));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Exporter;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once(__DIR__ . "/../../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class XmlExporterTest
|
||||
*
|
||||
* @package Tests\ProcessMaker\Project
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class XmlExporterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $exporter;
|
||||
protected static $projectUid = "";
|
||||
protected static $filePmx = "";
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$json = "
|
||||
{
|
||||
\"prj_name\": \"" . \ProcessMaker\Util\Common::generateUID() . "\",
|
||||
\"prj_author\": \"00000000000000000000000000000001\",
|
||||
\"diagrams\": [
|
||||
{
|
||||
\"dia_uid\": \"\",
|
||||
\"activities\": [],
|
||||
\"events\": [],
|
||||
\"gateways\": [],
|
||||
\"flows\": [],
|
||||
\"artifacts\": [],
|
||||
\"laneset\": [],
|
||||
\"lanes\": []
|
||||
}
|
||||
]
|
||||
}
|
||||
";
|
||||
|
||||
$arrayResult = \ProcessMaker\Project\Adapter\BpmnWorkflow::createFromStruct(json_decode($json, true));
|
||||
|
||||
self::$projectUid = $arrayResult[0]["new_uid"];
|
||||
self::$filePmx = PATH_DOCUMENT . "output" . PATH_SEP . self::$projectUid . ".pmx";
|
||||
|
||||
self::$exporter = new \ProcessMaker\Exporter\XmlExporter(self::$projectUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete project
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$bpmnWf = \ProcessMaker\Project\Adapter\BpmnWorkflow::load(self::$projectUid);
|
||||
$bpmnWf->remove();
|
||||
|
||||
unlink(self::$filePmx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test export
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::export
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function testExport()
|
||||
{
|
||||
$strXml = self::$exporter->export();
|
||||
|
||||
$this->assertTrue(is_string($strXml));
|
||||
$this->assertNotEmpty($strXml);
|
||||
|
||||
return $strXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::build
|
||||
*
|
||||
* @depends testExport
|
||||
* @param string $strXml Data xml
|
||||
*/
|
||||
public function testBuild($strXml)
|
||||
{
|
||||
//DOMDocument
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadXML($strXml);
|
||||
|
||||
$nodeRoot = $doc->getElementsByTagName("ProcessMaker-Project")->item(0);
|
||||
$uid = "";
|
||||
|
||||
//Node meta
|
||||
$nodeMeta = $nodeRoot->getElementsByTagName("metadata")->item(0)->getElementsByTagName("meta");
|
||||
|
||||
$this->assertNotEmpty($nodeMeta);
|
||||
|
||||
foreach ($nodeMeta as $value) {
|
||||
$node = $value;
|
||||
|
||||
if ($node->hasAttribute("key") && $node->getAttribute("key") == "uid") {
|
||||
$uid = $node->nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(self::$projectUid, $uid);
|
||||
|
||||
//Node definition
|
||||
$nodeDefinition = $nodeRoot->getElementsByTagName("definition");
|
||||
|
||||
$this->assertNotEmpty($nodeDefinition);
|
||||
|
||||
foreach ($nodeDefinition as $value) {
|
||||
$node = $value;
|
||||
|
||||
if ($node->hasAttribute("class")) {
|
||||
$this->assertContains($node->getAttribute("class"), array("BPMN", "workflow"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test saveExport
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::saveExport
|
||||
*/
|
||||
public function testSaveExport()
|
||||
{
|
||||
self::$exporter->saveExport(self::$filePmx);
|
||||
|
||||
$this->assertTrue(file_exists(self::$filePmx));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getTextNode
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::getTextNode
|
||||
*/
|
||||
public function testGetTextNode()
|
||||
{
|
||||
//Is not implemented. Method getTextNode() is private
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid project uid
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::__construct
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Project "ProcessMaker\Project\Bpmn" with UID: 0, does not exist.
|
||||
*/
|
||||
public function test__constructExceptionInvalidProjectUid()
|
||||
{
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter("0");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,216 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Importer;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once(__DIR__ . "/../../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class XmlImporterTest
|
||||
*
|
||||
* @package Tests\ProcessMaker\Project
|
||||
*/
|
||||
class XmlImporterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $importer;
|
||||
protected static $projectUid = "";
|
||||
protected static $filePmx = "";
|
||||
|
||||
protected static $arrayPrjUid = array();
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$json = "
|
||||
{
|
||||
\"prj_name\": \"" . \ProcessMaker\Util\Common::generateUID() . "\",
|
||||
\"prj_author\": \"00000000000000000000000000000001\",
|
||||
\"diagrams\": [
|
||||
{
|
||||
\"dia_uid\": \"\",
|
||||
\"activities\": [],
|
||||
\"events\": [],
|
||||
\"gateways\": [],
|
||||
\"flows\": [],
|
||||
\"artifacts\": [],
|
||||
\"laneset\": [],
|
||||
\"lanes\": []
|
||||
}
|
||||
]
|
||||
}
|
||||
";
|
||||
|
||||
$arrayResult = \ProcessMaker\Project\Adapter\BpmnWorkflow::createFromStruct(json_decode($json, true));
|
||||
|
||||
self::$projectUid = $arrayResult[0]["new_uid"];
|
||||
self::$filePmx = PATH_DOCUMENT . "input" . PATH_SEP . self::$projectUid . ".pmx";
|
||||
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter(self::$projectUid);
|
||||
$exporter->saveExport(self::$filePmx);
|
||||
|
||||
$bpmnWf = \ProcessMaker\Project\Adapter\BpmnWorkflow::load(self::$projectUid);
|
||||
$bpmnWf->remove();
|
||||
|
||||
self::$importer = new \ProcessMaker\Importer\XmlImporter();
|
||||
self::$importer->setSourceFile(self::$filePmx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete projects
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
foreach (self::$arrayPrjUid as $value) {
|
||||
$prjUid = $value;
|
||||
|
||||
$bpmnWf = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($prjUid);
|
||||
$bpmnWf->remove();
|
||||
}
|
||||
|
||||
unlink(self::$filePmx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test load
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::load
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
$arrayData = self::$importer->load();
|
||||
|
||||
$this->assertTrue(is_array($arrayData));
|
||||
$this->assertNotEmpty($arrayData);
|
||||
|
||||
$this->assertArrayHasKey("tables", $arrayData);
|
||||
$this->assertArrayHasKey("files", $arrayData);
|
||||
|
||||
$this->assertEquals($arrayData["tables"]["bpmn"]["project"][0]["prj_uid"], self::$projectUid);
|
||||
$this->assertEquals($arrayData["tables"]["workflow"]["process"][0]["PRO_UID"], self::$projectUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getTextNode
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::getTextNode
|
||||
*/
|
||||
public function testGetTextNode()
|
||||
{
|
||||
//Is not implemented. Method getTextNode() is private
|
||||
}
|
||||
|
||||
/**
|
||||
* Test import
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::import
|
||||
*/
|
||||
public function testImport()
|
||||
{
|
||||
$prjUid = self::$importer->import();
|
||||
self::$arrayPrjUid[] = $prjUid;
|
||||
|
||||
$this->assertNotNull(\BpmnProjectPeer::retrieveByPK($prjUid));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test importPostFile
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::importPostFile
|
||||
*/
|
||||
public function testImportPostFile()
|
||||
{
|
||||
self::$importer->setSaveDir(PATH_DOCUMENT . "input");
|
||||
|
||||
$arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => self::$projectUid . ".pmx"), "KEEP");
|
||||
self::$arrayPrjUid[] = $arrayData["PRJ_UID"];
|
||||
|
||||
$this->assertNotNull(\BpmnProjectPeer::retrieveByPK($arrayData["PRJ_UID"]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception when the project exists
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::import
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Project already exists, you need set an action to continue. Available actions: [project.import.create_new|project.import.override|project.import.disable_and_create_new|project.import.keep_without_changing_and_create_new].
|
||||
*/
|
||||
public function testImportExceptionProjectExists()
|
||||
{
|
||||
$prjUid = self::$importer->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for empty data
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::importPostFile
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty.
|
||||
*/
|
||||
public function testImportPostFileExceptionEmptyData()
|
||||
{
|
||||
$arrayData = self::$importer->importPostFile(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid extension
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::importPostFile
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The file extension not is "pmx"
|
||||
*/
|
||||
public function testImportPostFileExceptionInvalidExtension()
|
||||
{
|
||||
$arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => "file.pm"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for file does not exist
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::importPostFile
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The file with PROJECT_FILE: "file.pmx" does not exist.
|
||||
*/
|
||||
public function testImportPostFileExceptionFileNotExists()
|
||||
{
|
||||
$arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => "file.pmx"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid option
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::importPostFile
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Invalid value for "OPTION", it only accepts values: "CREATE|OVERWRITE|DISABLE|KEEP".
|
||||
*/
|
||||
public function testImportPostFileExceptionInvalidOption()
|
||||
{
|
||||
$arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => "file.pmx"), "CREATED");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception when the project exists
|
||||
*
|
||||
* @covers \ProcessMaker\Importer\XmlImporter::importPostFile
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Project already exists, you need set an action to continue. Available actions: [CREATE|OVERWRITE|DISABLE|KEEP].
|
||||
*/
|
||||
public function testImportPostFileExceptionProjectExists()
|
||||
{
|
||||
self::$importer->setSaveDir(PATH_DOCUMENT . "input");
|
||||
|
||||
$arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => self::$projectUid . ".pmx"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,713 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Project\Adapter;
|
||||
|
||||
use \ProcessMaker\Project;
|
||||
use \ProcessMaker\Exception;
|
||||
|
||||
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../../../bootstrap.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* Class BpmnWorkflowTest
|
||||
*
|
||||
* @package Tests\ProcessMaker\Project\Adapter
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class BpmnWorkflowTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $uids = array();
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
//return false;
|
||||
//cleaning DB
|
||||
foreach (self::$uids as $prjUid) {
|
||||
$bwap = Project\Adapter\BpmnWorkflow::load($prjUid);
|
||||
$bwap->remove();
|
||||
}
|
||||
}
|
||||
|
||||
function testNew()
|
||||
{
|
||||
$data = array(
|
||||
"PRJ_NAME" => "Test Bpmn/Workflow Project #1.". rand(1, 100),
|
||||
"PRJ_DESCRIPTION" => "Description for - Test BPMN Project #1." . rand(1, 100),
|
||||
"PRJ_AUTHOR" => "00000000000000000000000000000001"
|
||||
);
|
||||
|
||||
$bwap = new Project\Adapter\BpmnWorkflow($data);
|
||||
|
||||
try {
|
||||
$bp = Project\Bpmn::load($bwap->getUid());
|
||||
} catch (\Exception $e){
|
||||
$bp = null;
|
||||
}
|
||||
|
||||
try {
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
} catch (\Exception $e){
|
||||
$wp = null;
|
||||
}
|
||||
|
||||
self::$uids[] = $bwap->getUid();
|
||||
|
||||
$this->assertNotNull($bp);
|
||||
$this->assertNotNull($wp);
|
||||
$this->assertEquals($bp->getUid(), $wp->getUid());
|
||||
|
||||
$project = $bp->getProject();
|
||||
$process = $wp->getProcess();
|
||||
|
||||
$this->assertEquals($project["PRJ_NAME"], $process["PRO_TITLE"]);
|
||||
$this->assertEquals($project["PRJ_DESCRIPTION"], $process["PRO_DESCRIPTION"]);
|
||||
$this->assertEquals($project["PRJ_AUTHOR"], $process["PRO_CREATE_USER"]);
|
||||
|
||||
return $bwap;
|
||||
}
|
||||
|
||||
function testCreate()
|
||||
{
|
||||
$data = array(
|
||||
"PRJ_NAME" => "Test Bpmn/Workflow Project #2",
|
||||
"PRJ_DESCRIPTION" => "Description for - Test BPMN Project #2",
|
||||
"PRJ_AUTHOR" => "00000000000000000000000000000001"
|
||||
);
|
||||
|
||||
$bwap = new Project\Adapter\BpmnWorkflow();
|
||||
$bwap->create($data);
|
||||
|
||||
try {
|
||||
$bp = Project\Bpmn::load($bwap->getUid());
|
||||
} catch (\Exception $e){
|
||||
$bp = null;
|
||||
}
|
||||
|
||||
try {
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
} catch (\Exception $e){
|
||||
$wp = null;
|
||||
}
|
||||
|
||||
$this->assertNotEmpty($bp);
|
||||
$this->assertNotEmpty($wp);
|
||||
$this->assertEquals($bp->getUid(), $wp->getUid());
|
||||
|
||||
$project = $bp->getProject();
|
||||
$process = $wp->getProcess();
|
||||
|
||||
$this->assertEquals($project["PRJ_NAME"], $process["PRO_TITLE"]);
|
||||
$this->assertEquals($project["PRJ_DESCRIPTION"], $process["PRO_DESCRIPTION"]);
|
||||
$this->assertEquals($project["PRJ_AUTHOR"], $process["PRO_CREATE_USER"]);
|
||||
|
||||
return $bwap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
*/
|
||||
function testRemove(Project\Adapter\BpmnWorkflow $bwap)
|
||||
{
|
||||
$prjUid = $bwap->getUid();
|
||||
$bwap->remove();
|
||||
$bp = $wp = null;
|
||||
|
||||
try {
|
||||
$bp = Project\Bpmn::load($prjUid);
|
||||
} catch (Exception\ProjectNotFound $e) {}
|
||||
|
||||
try {
|
||||
$wp = Project\Workflow::load($prjUid);
|
||||
} catch (Exception\ProjectNotFound $e) {}
|
||||
|
||||
$this->assertNull($bp);
|
||||
$this->assertNull($wp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Testing Project's Activity
|
||||
*/
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @return string
|
||||
*/
|
||||
function testAddActivity($bwap)
|
||||
{
|
||||
// before add activity, we need to add a diagram and process to the project
|
||||
$bwap->addDiagram();
|
||||
$bwap->addProcess();
|
||||
|
||||
// add the new activity
|
||||
$actUid = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => "50",
|
||||
"BOU_Y" => "50"
|
||||
));
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
|
||||
$activity = $bwap->getActivity($actUid);
|
||||
$task = $wp->getTask($actUid);
|
||||
|
||||
$this->assertEquals($activity["ACT_NAME"], $task["TAS_TITLE"]);
|
||||
$this->assertEquals($activity["BOU_X"], $task["TAS_POSX"]);
|
||||
$this->assertEquals($activity["BOU_Y"], $task["TAS_POSY"]);
|
||||
|
||||
return $actUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testAddActivity
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @param string $actUid
|
||||
*/
|
||||
function testUpdateActivity($bwap, $actUid)
|
||||
{
|
||||
$updatedData = array(
|
||||
"ACT_NAME" => "Activity #1 - (Modified)",
|
||||
"BOU_X" => 122,
|
||||
"BOU_Y" => 250
|
||||
);
|
||||
|
||||
$bwap->updateActivity($actUid, $updatedData);
|
||||
$activity = $bwap->getActivity($actUid);
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
$task = $wp->getTask($actUid);
|
||||
|
||||
$this->assertEquals($activity["ACT_NAME"], $task["TAS_TITLE"]);
|
||||
$this->assertEquals($activity["BOU_X"], $task["TAS_POSX"]);
|
||||
$this->assertEquals($activity["BOU_Y"], $task["TAS_POSY"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testAddActivity
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @param string $actUid
|
||||
*/
|
||||
function testRemoveActivity($bwap, $actUid)
|
||||
{
|
||||
$bwap->removeActivity($actUid);
|
||||
$activity = $bwap->getActivity($actUid);
|
||||
|
||||
$this->assertNull($activity);
|
||||
}
|
||||
|
||||
/*
|
||||
* Testing Project's Flows
|
||||
*/
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @return string
|
||||
*/
|
||||
function testAddActivityToActivityFlow($bwap)
|
||||
{
|
||||
$actUid1 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => 122,
|
||||
"BOU_Y" => 222
|
||||
));
|
||||
$actUid2 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #2",
|
||||
"BOU_X" => 322,
|
||||
"BOU_Y" => 422
|
||||
));
|
||||
|
||||
$flowData = array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $actUid1,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnActivity',
|
||||
'FLO_ELEMENT_DEST' => $actUid2,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnActivity',
|
||||
'FLO_X1' => 326,
|
||||
'FLO_Y1' => 146,
|
||||
'FLO_X2' => 461,
|
||||
'FLO_Y2' => 146,
|
||||
);
|
||||
|
||||
$flowUid = $bwap->addFlow($flowData);
|
||||
$bwap->mapBpmnFlowsToWorkflowRoutes();
|
||||
|
||||
$route = \Route::findOneBy(array(
|
||||
\RoutePeer::TAS_UID => $actUid1,
|
||||
\RoutePeer::ROU_NEXT_TASK => $actUid2
|
||||
));
|
||||
|
||||
$this->assertNotNull($route);
|
||||
$this->assertTrue(is_string($flowUid));
|
||||
$this->assertEquals(32, strlen($flowUid));
|
||||
$this->assertEquals($route->getRouNextTask(), $actUid2);
|
||||
$this->assertEquals($route->getRouType(), "SEQUENTIAL");
|
||||
|
||||
return array("flow_uid" => $flowUid, "activitiesUid" => array($actUid1, $actUid2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testAddActivityToActivityFlow
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @param array $input
|
||||
*/
|
||||
function testRemoveActivityToActivityFlow($bwap, $input)
|
||||
{
|
||||
$bwap->removeFlow($input["flow_uid"]);
|
||||
$this->assertNull($bwap->getFlow($input["flow_uid"]));
|
||||
|
||||
$route = \Route::findOneBy(array(
|
||||
\RoutePeer::TAS_UID => $input["activitiesUid"][0],
|
||||
\RoutePeer::ROU_NEXT_TASK => $input["activitiesUid"][1]
|
||||
));
|
||||
|
||||
$this->assertNull($route);
|
||||
|
||||
// cleaning
|
||||
$bwap->removeActivity($input["activitiesUid"][0]);
|
||||
$bwap->removeActivity($input["activitiesUid"][1]);
|
||||
|
||||
$this->assertCount(0, $bwap->getActivities());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
*/
|
||||
function testActivityToInclusiveGatewayToActivityFlowsSingle($bwap)
|
||||
{
|
||||
$actUid1 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => 198,
|
||||
"BOU_Y" => 56
|
||||
));
|
||||
$actUid2 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #2",
|
||||
"BOU_X" => 198,
|
||||
"BOU_Y" => 250
|
||||
));
|
||||
$gatUid = $bwap->addGateway(array(
|
||||
"GAT_NAME" => "Gateway #1",
|
||||
"GAT_TYPE" => "INCLUSIVE",
|
||||
"GAT_DIRECTION" => "DIVERGING",
|
||||
"BOU_X" => 256,
|
||||
"BOU_Y" => 163
|
||||
));
|
||||
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $actUid1,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnActivity',
|
||||
'FLO_ELEMENT_DEST' => $gatUid,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnGateway',
|
||||
'FLO_X1' => 273,
|
||||
'FLO_Y1' => 273,
|
||||
'FLO_X2' => 163,
|
||||
'FLO_Y2' => 163,
|
||||
));
|
||||
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $gatUid,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnGateway',
|
||||
'FLO_ELEMENT_DEST' => $actUid2,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnActivity',
|
||||
'FLO_X1' => 273,
|
||||
'FLO_Y1' => 273,
|
||||
'FLO_X2' => 249,
|
||||
'FLO_Y2' => 249,
|
||||
));
|
||||
|
||||
$bwap->mapBpmnFlowsToWorkflowRoutes();
|
||||
|
||||
$this->assertCount(2, $bwap->getActivities());
|
||||
$this->assertCount(1, $bwap->getGateways());
|
||||
$this->assertCount(2, $bwap->getFlows());
|
||||
|
||||
$flows1 = \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_DEST, $gatUid);
|
||||
$flows2 = \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $gatUid);
|
||||
|
||||
$this->assertCount(1, $flows1);
|
||||
$this->assertCount(1, $flows2);
|
||||
$this->assertEquals($flows1[0]->getFloElementOrigin(), $actUid1);
|
||||
$this->assertEquals($flows2[0]->getFloElementDest(), $actUid2);
|
||||
|
||||
// cleaning
|
||||
$this->resetProject($bwap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
*/
|
||||
function testActivityToInclusiveGatewayToActivityFlowsMultiple($bwap)
|
||||
{
|
||||
$actUid1 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => 311,
|
||||
"BOU_Y" => 26
|
||||
));
|
||||
$actUid2 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #2",
|
||||
"BOU_X" => 99,
|
||||
"BOU_Y" => 200
|
||||
));
|
||||
$actUid3 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #3",
|
||||
"BOU_X" => 310,
|
||||
"BOU_Y" => 200
|
||||
));
|
||||
$actUid4 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #4",
|
||||
"BOU_X" => 542,
|
||||
"BOU_Y" => 200
|
||||
));
|
||||
$gatUid = $bwap->addGateway(array(
|
||||
"GAT_NAME" => "Gateway #1",
|
||||
"GAT_TYPE" => "INCLUSIVE",
|
||||
"GAT_DIRECTION" => "DIVERGING",
|
||||
"BOU_X" => 369,
|
||||
"BOU_Y" => 123
|
||||
));
|
||||
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $actUid1,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnActivity',
|
||||
'FLO_ELEMENT_DEST' => $gatUid,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnGateway',
|
||||
'FLO_X1' => 386,
|
||||
'FLO_Y1' => 174,
|
||||
'FLO_X2' => 206,
|
||||
'FLO_Y2' => 206,
|
||||
));
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $gatUid,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnGateway',
|
||||
'FLO_ELEMENT_DEST' => $actUid2,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnActivity',
|
||||
'FLO_X1' => 273,
|
||||
'FLO_Y1' => 273,
|
||||
'FLO_X2' => 249,
|
||||
'FLO_Y2' => 249,
|
||||
));
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $gatUid,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnGateway',
|
||||
'FLO_ELEMENT_DEST' => $actUid3,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnActivity',
|
||||
'FLO_X1' => 386,
|
||||
'FLO_Y1' => 174,
|
||||
'FLO_X2' => 206,
|
||||
'FLO_Y2' => 206,
|
||||
));
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $gatUid,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnGateway',
|
||||
'FLO_ELEMENT_DEST' => $actUid4,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnActivity',
|
||||
'FLO_X1' => 386,
|
||||
'FLO_Y1' => 617,
|
||||
'FLO_X2' => 207,
|
||||
'FLO_Y2' => 207,
|
||||
));
|
||||
|
||||
$bwap->mapBpmnFlowsToWorkflowRoutes();
|
||||
|
||||
$this->assertCount(4, $bwap->getActivities());
|
||||
$this->assertCount(1, $bwap->getGateways());
|
||||
$this->assertCount(4, $bwap->getFlows());
|
||||
$this->assertCount(1, \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_DEST, $gatUid));
|
||||
$this->assertCount(3, \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $gatUid));
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
|
||||
$this->assertCount(4, $wp->getTasks());
|
||||
$this->assertCount(3, $wp->getRoutes());
|
||||
$this->assertCount(3, \Route::findAllBy(\RoutePeer::TAS_UID, $actUid1));
|
||||
$this->assertCount(1, \Route::findAllBy(\RoutePeer::ROU_NEXT_TASK, $actUid2));
|
||||
$this->assertCount(1, \Route::findAllBy(\RoutePeer::ROU_NEXT_TASK, $actUid3));
|
||||
$this->assertCount(1, \Route::findAllBy(\RoutePeer::ROU_NEXT_TASK, $actUid4));
|
||||
|
||||
return array($actUid2, $actUid3, $actUid4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testActivityToInclusiveGatewayToActivityFlowsMultiple
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @param array $activitiesUid
|
||||
*/
|
||||
function testActivityToInclusiveGatewayToActivityFlowsMultipleJoin($bwap, $activitiesUid)
|
||||
{
|
||||
$gatUid = $bwap->addGateway(array(
|
||||
"GAT_NAME" => "Gateway #2",
|
||||
"GAT_TYPE" => "INCLUSIVE",
|
||||
"GAT_DIRECTION" => "CONVERGING",
|
||||
"BOU_X" => 369,
|
||||
"BOU_Y" => 338
|
||||
));
|
||||
$actUid5 = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #5",
|
||||
"BOU_X" => 312,
|
||||
"BOU_Y" => 464
|
||||
));
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $activitiesUid[0],
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnActivity',
|
||||
'FLO_ELEMENT_DEST' => $gatUid,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnGateway',
|
||||
'FLO_X1' => 174,
|
||||
'FLO_Y1' => 365,
|
||||
'FLO_X2' => 355,
|
||||
'FLO_Y2' => 355,
|
||||
));
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $activitiesUid[1],
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnActivity',
|
||||
'FLO_ELEMENT_DEST' => $gatUid,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnGateway',
|
||||
'FLO_X1' => 385,
|
||||
'FLO_Y1' => 382,
|
||||
'FLO_X2' => 338,
|
||||
'FLO_Y2' => 338,
|
||||
));
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $activitiesUid[2],
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnActivity',
|
||||
'FLO_ELEMENT_DEST' => $gatUid,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnGateway',
|
||||
'FLO_X1' => 617,
|
||||
'FLO_Y1' => 398,
|
||||
'FLO_X2' => 355,
|
||||
'FLO_Y2' => 355,
|
||||
));
|
||||
|
||||
$bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $gatUid,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnGateway',
|
||||
'FLO_ELEMENT_DEST' => $actUid5,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnActivity',
|
||||
'FLO_X1' => 382,
|
||||
'FLO_Y1' => 387,
|
||||
'FLO_X2' => 463,
|
||||
'FLO_Y2' => 463,
|
||||
));
|
||||
|
||||
$bwap->mapBpmnFlowsToWorkflowRoutes();
|
||||
|
||||
$this->assertCount(8, $bwap->getFlows());
|
||||
$this->assertCount(5, $bwap->getActivities());
|
||||
$this->assertCount(2, $bwap->getGateways());
|
||||
$this->assertCount(3, \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_DEST, $gatUid));
|
||||
$this->assertCount(1, \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $gatUid));
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
|
||||
$this->assertCount(5, $wp->getTasks());
|
||||
$this->assertCount(6, $wp->getRoutes());
|
||||
|
||||
$this->assertCount(1, \Route::findAllBy(\RoutePeer::TAS_UID, $activitiesUid[0]));
|
||||
$this->assertCount(1, \Route::findAllBy(\RoutePeer::TAS_UID, $activitiesUid[1]));
|
||||
$this->assertCount(1, \Route::findAllBy(\RoutePeer::TAS_UID, $activitiesUid[2]));
|
||||
$this->assertCount(3, \Route::findAllBy(\RoutePeer::ROU_NEXT_TASK, $actUid5));
|
||||
|
||||
// cleaning
|
||||
$this->resetProject($bwap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @return string
|
||||
*/
|
||||
function testSetStartEvent($bwap)
|
||||
{
|
||||
$actUid = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => 312,
|
||||
"BOU_Y" => 464
|
||||
));
|
||||
$evnUid = $bwap->addEvent(array(
|
||||
"EVN_NAME" => "Event #1",
|
||||
"EVN_TYPE" => "START",
|
||||
"BOU_X" => 369,
|
||||
"BOU_Y" => 338,
|
||||
"EVN_MARKER" => "MESSAGE",
|
||||
"EVN_MESSAGE" => "LEAD"
|
||||
));
|
||||
$floUid = $bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $evnUid,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnEvent',
|
||||
'FLO_ELEMENT_DEST' => $actUid,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnActivity',
|
||||
'FLO_X1' => 174,
|
||||
'FLO_Y1' => 365,
|
||||
'FLO_X2' => 355,
|
||||
'FLO_Y2' => 355,
|
||||
));
|
||||
|
||||
$this->assertCount(1, $bwap->getActivities());
|
||||
$this->assertCount(1, $bwap->getEvents());
|
||||
$this->assertCount(1, $bwap->getFlows());
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
$task = $wp->getTask($actUid);
|
||||
|
||||
$this->assertCount(1, $wp->getTasks());
|
||||
$this->assertCount(0, $wp->getRoutes());
|
||||
$this->assertNotNull($task);
|
||||
|
||||
$this->assertEquals($task["TAS_START"], "TRUE");
|
||||
|
||||
return $floUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testSetStartEvent
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @param string $floUid
|
||||
*/
|
||||
function testUnsetStartEvent($bwap, $floUid)
|
||||
{
|
||||
$bwap->removeFlow($floUid);
|
||||
|
||||
$this->assertCount(1, $bwap->getActivities());
|
||||
$this->assertCount(1, $bwap->getEvents());
|
||||
$this->assertCount(0, $bwap->getFlows());
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertCount(1, $tasks);
|
||||
$this->assertCount(0, $wp->getRoutes());
|
||||
$this->assertEquals($tasks[0]["TAS_START"], "FALSE");
|
||||
|
||||
// cleaning
|
||||
$this->resetProject($bwap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
*/
|
||||
function testSetEndEvent($bwap)
|
||||
{
|
||||
$actUid = $bwap->addActivity(array(
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => 312,
|
||||
"BOU_Y" => 464
|
||||
));
|
||||
$evnUid = $bwap->addEvent(array(
|
||||
"EVN_NAME" => "Event #1",
|
||||
"EVN_TYPE" => "END",
|
||||
"BOU_X" => 369,
|
||||
"BOU_Y" => 338,
|
||||
"EVN_MARKER" => "MESSAGE",
|
||||
"EVN_MESSAGE" => "LEAD"
|
||||
));
|
||||
$floUid = $bwap->addFlow(array(
|
||||
'FLO_TYPE' => 'SEQUENCE',
|
||||
'FLO_ELEMENT_ORIGIN' => $actUid,
|
||||
'FLO_ELEMENT_ORIGIN_TYPE' => 'bpmnActivity',
|
||||
'FLO_ELEMENT_DEST' => $evnUid,
|
||||
'FLO_ELEMENT_DEST_TYPE' => 'bpmnEvent',
|
||||
'FLO_X1' => 174,
|
||||
'FLO_Y1' => 365,
|
||||
'FLO_X2' => 355,
|
||||
'FLO_Y2' => 355,
|
||||
));
|
||||
|
||||
$this->assertCount(1, $bwap->getActivities());
|
||||
$this->assertCount(1, $bwap->getEvents());
|
||||
$this->assertCount(1, $bwap->getFlows());
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
$task = $wp->getTask($actUid);
|
||||
|
||||
$this->assertCount(1, $wp->getTasks());
|
||||
$this->assertCount(1, $wp->getRoutes());
|
||||
$this->assertNotNull($task);
|
||||
|
||||
$routes = \Route::findAllBy(\RoutePeer::TAS_UID, $task["TAS_UID"]);
|
||||
|
||||
$this->assertCount(1, $routes);
|
||||
$this->assertEquals($routes[0]->getRouNextTask(), "-1");
|
||||
|
||||
return $floUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNew
|
||||
* @depends testSetEndEvent
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
* @param $floUid
|
||||
*/
|
||||
function testUnsetEndEvent($bwap, $floUid)
|
||||
{
|
||||
$bwap->removeFlow($floUid);
|
||||
|
||||
$this->assertCount(1, $bwap->getActivities());
|
||||
$this->assertCount(1, $bwap->getEvents());
|
||||
$this->assertCount(0, $bwap->getFlows());
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
|
||||
$this->assertCount(1, $wp->getTasks());
|
||||
$this->assertCount(0, $wp->getRoutes());
|
||||
|
||||
// cleaning
|
||||
$this->resetProject($bwap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ProcessMaker\Project\Adapter\BpmnWorkflow $bwap
|
||||
*/
|
||||
protected function resetProject(\ProcessMaker\Project\Adapter\BpmnWorkflow $bwap)
|
||||
{
|
||||
// cleaning
|
||||
$activities = $bwap->getActivities();
|
||||
foreach ($activities as $activity) {
|
||||
$bwap->removeActivity($activity["ACT_UID"]);
|
||||
}
|
||||
$events = $bwap->getEvents();
|
||||
foreach ($events as $event) {
|
||||
$bwap->removeEvent($event["EVN_UID"]);
|
||||
}
|
||||
$gateways = $bwap->getGateways();
|
||||
foreach ($gateways as $gateway) {
|
||||
$bwap->removeGateway($gateway["GAT_UID"]);
|
||||
}
|
||||
$flows = $bwap->getFlows();
|
||||
foreach ($flows as $flow) {
|
||||
$bwap->removeFlow($flow["FLO_UID"]);
|
||||
}
|
||||
|
||||
// verifying that project is cleaned
|
||||
$this->assertCount(0, $bwap->getActivities());
|
||||
$this->assertCount(0, $bwap->getEvents());
|
||||
$this->assertCount(0, $bwap->getGateways());
|
||||
$this->assertCount(0, $bwap->getFlows());
|
||||
|
||||
$wp = Project\Workflow::load($bwap->getUid());
|
||||
|
||||
$this->assertCount(0, $wp->getTasks());
|
||||
$this->assertCount(0, $wp->getRoutes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Project\Adapter;
|
||||
|
||||
use \ProcessMaker\Project;
|
||||
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../../../bootstrap.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WorkflowBpmnTest
|
||||
*
|
||||
* @package Tests\ProcessMaker\Project\Adapter
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class WorkflowBpmnTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $uids = array();
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
//cleaning DB
|
||||
foreach (self::$uids as $prjUid) {
|
||||
$wbpa = Project\Adapter\WorkflowBpmn::load($prjUid);
|
||||
$wbpa->remove();
|
||||
}
|
||||
}
|
||||
|
||||
function testNew()
|
||||
{
|
||||
$data = array(
|
||||
"PRO_TITLE" => "Test Workflow/Bpmn Project #1",
|
||||
"PRO_DESCRIPTION" => "Description for - Test Project #1",
|
||||
"PRO_CREATE_USER" => "00000000000000000000000000000001"
|
||||
);
|
||||
|
||||
$wbap = new Project\Adapter\WorkflowBpmn($data);
|
||||
|
||||
try {
|
||||
$bp = Project\Bpmn::load($wbap->getUid());
|
||||
} catch (\Exception $e){die($e->getMessage());}
|
||||
|
||||
try {
|
||||
$wp = Project\Workflow::load($wbap->getUid());
|
||||
} catch (\Exception $e){}
|
||||
|
||||
self::$uids[] = $wbap->getUid();
|
||||
|
||||
$this->assertNotNull($bp);
|
||||
$this->assertNotNull($wp);
|
||||
$this->assertEquals($bp->getUid(), $wp->getUid());
|
||||
|
||||
$project = $bp->getProject();
|
||||
$process = $wp->getProcess();
|
||||
|
||||
$this->assertEquals($project["PRJ_NAME"], $process["PRO_TITLE"]);
|
||||
$this->assertEquals($project["PRJ_DESCRIPTION"], $process["PRO_DESCRIPTION"]);
|
||||
$this->assertEquals($project["PRJ_AUTHOR"], $process["PRO_CREATE_USER"]);
|
||||
}
|
||||
|
||||
function testCreate()
|
||||
{
|
||||
$data = array(
|
||||
"PRO_TITLE" => "Test Workflow/Bpmn Project #2",
|
||||
"PRO_DESCRIPTION" => "Description for - Test Project #2",
|
||||
"PRO_CREATE_USER" => "00000000000000000000000000000001"
|
||||
);
|
||||
$wbap = new Project\Adapter\WorkflowBpmn();
|
||||
$wbap->create($data);
|
||||
|
||||
try {
|
||||
$bp = Project\Bpmn::load($wbap->getUid());
|
||||
} catch (\Exception $e){}
|
||||
|
||||
try {
|
||||
$wp = Project\Workflow::load($wbap->getUid());
|
||||
} catch (\Exception $e){}
|
||||
|
||||
self::$uids[] = $wbap->getUid();
|
||||
|
||||
$this->assertNotEmpty($bp);
|
||||
$this->assertNotEmpty($wp);
|
||||
$this->assertEquals($bp->getUid(), $wp->getUid());
|
||||
|
||||
$project = $bp->getProject();
|
||||
$process = $wp->getProcess();
|
||||
|
||||
$this->assertEquals($project["PRJ_NAME"], $process["PRO_TITLE"]);
|
||||
$this->assertEquals($project["PRJ_DESCRIPTION"], $process["PRO_DESCRIPTION"]);
|
||||
$this->assertEquals($project["PRJ_AUTHOR"], $process["PRO_CREATE_USER"]);
|
||||
}
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Project;
|
||||
|
||||
use \ProcessMaker\Project;
|
||||
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../../bootstrap.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* Class BpmnTest
|
||||
*
|
||||
* @package Tests\ProcessMaker\Project
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class BpmnTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $prjUids = array();
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
//return;
|
||||
|
||||
//cleaning DB
|
||||
foreach (self::$prjUids as $prjUid) {
|
||||
$bp = Project\Bpmn::load($prjUid);
|
||||
$bp->remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
$data = array(
|
||||
"PRJ_NAME" => "Test BPMN Project #1",
|
||||
"PRJ_DESCRIPTION" => "Description for - Test BPMN Project #1",
|
||||
"PRJ_AUTHOR" => "00000000000000000000000000000001"
|
||||
);
|
||||
|
||||
// Create a new Project\Bpmn and save to DB
|
||||
$bp = new Project\Bpmn($data);
|
||||
$projectData = $bp->getProject();
|
||||
self::$prjUids[] = $bp->getUid();
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$this->assertEquals($value, $projectData[$key]);
|
||||
}
|
||||
|
||||
return $bp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @var $bp \ProcessMaker\Project\Bpmn
|
||||
*/
|
||||
public function testAddDiagram($bp)
|
||||
{
|
||||
$data = array(
|
||||
"DIA_NAME" => "Sample Diagram #1"
|
||||
);
|
||||
|
||||
// Save to DB
|
||||
$bp->addDiagram($data);
|
||||
|
||||
// Load from DB
|
||||
$diagramData = $bp->getDiagram();
|
||||
|
||||
$this->assertEquals($data["DIA_NAME"], $diagramData["DIA_NAME"]);
|
||||
$this->assertEquals($bp->getUid(), $diagramData["PRJ_UID"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @var $bp \ProcessMaker\Project\Bpmn
|
||||
*/
|
||||
public function testAddProcess($bp)
|
||||
{
|
||||
$data = array(
|
||||
"PRO_NAME" => "Sample Process #1"
|
||||
);
|
||||
|
||||
$diagramData = $bp->getDiagram();
|
||||
|
||||
// Save to DB
|
||||
$bp->addProcess($data);
|
||||
|
||||
// Load from DB
|
||||
$processData = $bp->getProcess();
|
||||
|
||||
$this->assertEquals($data["PRO_NAME"], $processData["PRO_NAME"]);
|
||||
$this->assertEquals($bp->getUid(), $processData["PRJ_UID"]);
|
||||
$this->assertEquals($diagramData['DIA_UID'], $processData["DIA_UID"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @var $bp \ProcessMaker\Project\Bpmn
|
||||
*/
|
||||
public function testAddActivity($bp)
|
||||
{
|
||||
$data = array(
|
||||
"ACT_NAME" => "Activity #1",
|
||||
"BOU_X" => "50",
|
||||
"BOU_Y" => "50"
|
||||
);
|
||||
|
||||
// Save to DB
|
||||
$bp->addActivity($data);
|
||||
|
||||
// Load from DB
|
||||
$activities = $bp->getActivities();
|
||||
|
||||
$this->assertCount(1, $activities);
|
||||
|
||||
$activityData = $activities[0];
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$this->assertEquals($value, $activityData[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @param $bp \ProcessMaker\Project\Bpmn
|
||||
* @return array
|
||||
*/
|
||||
public function testAddActivityWithUid($bp)
|
||||
{
|
||||
$actUid = "f1198ddc864204561817155064020352";
|
||||
|
||||
$data = array(
|
||||
"ACT_UID" => $actUid,
|
||||
"ACT_NAME" => "Activity #X",
|
||||
"BOU_X" => "50",
|
||||
"BOU_Y" => "50"
|
||||
);
|
||||
|
||||
// Save to DB
|
||||
$bp->addActivity($data);
|
||||
|
||||
// Load from DB
|
||||
$activities = $bp->getActivities();
|
||||
|
||||
$uids = array();
|
||||
|
||||
foreach ($activities as $activity) {
|
||||
array_push($uids, $activity["ACT_UID"]);
|
||||
}
|
||||
|
||||
$this->assertTrue(in_array($actUid, $uids));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @depends testAddActivityWithUid
|
||||
* @param $bp \ProcessMaker\Project\Bpmn
|
||||
* @param $data
|
||||
*/
|
||||
public function testGetActivity($bp, $data)
|
||||
{
|
||||
// Load from DB
|
||||
$activityData = $bp->getActivity($data["ACT_UID"]);
|
||||
|
||||
// in data is set a determined UID for activity created in previous step
|
||||
foreach ($data as $key => $value) {
|
||||
$this->assertEquals($value, $activityData[$key]);
|
||||
}
|
||||
|
||||
// Testing with an invalid uid
|
||||
$this->assertNull($bp->getActivity("INVALID-UID"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @depends testAddActivityWithUid
|
||||
* @param $bp \ProcessMaker\Project\Bpmn
|
||||
* @param $data
|
||||
*/
|
||||
public function testUpdateActivity($bp, $data)
|
||||
{
|
||||
$updateData = array(
|
||||
"ACT_NAME" => "Activity #X (Updated)",
|
||||
"BOU_X" => "251",
|
||||
"BOU_Y" => "252"
|
||||
);
|
||||
|
||||
// Save to DB
|
||||
$bp->updateActivity($data["ACT_UID"], $updateData);
|
||||
|
||||
// Load from DB
|
||||
$activityData = $bp->getActivity($data["ACT_UID"]);
|
||||
|
||||
foreach ($updateData as $key => $value) {
|
||||
$this->assertEquals($value, $activityData[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
* @depends testAddActivityWithUid
|
||||
* @param $bp \ProcessMaker\Project\Bpmn
|
||||
* @param $data
|
||||
*/
|
||||
public function testRemoveActivity($bp, $data)
|
||||
{
|
||||
$this->assertCount(2, $bp->getActivities());
|
||||
|
||||
$bp->removeActivity($data["ACT_UID"]);
|
||||
|
||||
$this->assertCount(1, $bp->getActivities());
|
||||
}
|
||||
|
||||
public function testGetActivities()
|
||||
{
|
||||
// Create a new Project\Bpmn and save to DB
|
||||
$bp = new Project\Bpmn(array(
|
||||
"PRJ_NAME" => "Test BPMN Project #2",
|
||||
"PRJ_DESCRIPTION" => "Description for - Test BPMN Project #1",
|
||||
"PRJ_AUTHOR" => "00000000000000000000000000000001"
|
||||
));
|
||||
$bp->addDiagram();
|
||||
$bp->addProcess();
|
||||
|
||||
$this->assertCount(0, $bp->getActivities());
|
||||
|
||||
// Save to DB
|
||||
$bp->addActivity(array(
|
||||
"ACT_NAME" => "Activity #2",
|
||||
"BOU_X" => "50",
|
||||
"BOU_Y" => "50"
|
||||
));
|
||||
|
||||
$bp->addActivity(array(
|
||||
"ACT_NAME" => "Activity #3",
|
||||
"BOU_X" => "50",
|
||||
"BOU_Y" => "50"
|
||||
));
|
||||
|
||||
$this->assertCount(2, $bp->getActivities());
|
||||
|
||||
return $bp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testGetActivities
|
||||
* @param $bp \ProcessMaker\Project\Bpmn
|
||||
* @return null|\ProcessMaker\Project\Bpmn
|
||||
*/
|
||||
public function testLoad($bp)
|
||||
{
|
||||
$prjUid = $bp->getUid();
|
||||
$bp2 = Project\Bpmn::load($prjUid);
|
||||
|
||||
$this->assertNotNull($bp2);
|
||||
$this->assertEquals($bp->getActivities(), $bp2->getActivities());
|
||||
$this->assertEquals($bp->getDiagram(), $bp2->getDiagram());
|
||||
$this->assertEquals($bp->getProcess(), $bp2->getProcess());
|
||||
|
||||
return $bp2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testLoad
|
||||
* @param $bp \ProcessMaker\Project\Bpmn
|
||||
* @expectedException \ProcessMaker\Exception\ProjectNotFound
|
||||
* @expectedExceptionCode 20
|
||||
*/
|
||||
public function testRemove($bp)
|
||||
{
|
||||
$prjUid = $bp->getUid();
|
||||
$bp->remove();
|
||||
|
||||
Project\Bpmn::load($prjUid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Project;
|
||||
|
||||
use \ProcessMaker\Project;
|
||||
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../../bootstrap.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WorkflowTest
|
||||
*
|
||||
* @package Tests\ProcessMaker\Project
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class WorkflowTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $proUids = array();
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
//cleaning DB
|
||||
foreach (self::$proUids as $proUid) {
|
||||
$wp = Project\Workflow::load($proUid);
|
||||
$wp->remove();
|
||||
}
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
$data = array(
|
||||
"PRO_TITLE" => "Test Project #1",
|
||||
"PRO_DESCRIPTION" => "Description for - Test Project #1",
|
||||
"PRO_CATEGORY" => "",
|
||||
"PRO_CREATE_USER" => "00000000000000000000000000000001"
|
||||
);
|
||||
|
||||
$wp = new Project\Workflow($data);
|
||||
self::$proUids[] = $wp->getUid();
|
||||
|
||||
$processData = $wp->getProcess();
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$this->assertEquals($data[$key], $processData[$key]);
|
||||
}
|
||||
|
||||
return $wp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
*/
|
||||
public function testAddTask($wp)
|
||||
{
|
||||
$data = array(
|
||||
"TAS_TITLE" => "task #1",
|
||||
"TAS_DESCRIPTION" => "Description for task #1",
|
||||
"TAS_POSX" => "50",
|
||||
"TAS_POSY" => "50",
|
||||
"TAS_WIDTH" => "100",
|
||||
"TAS_HEIGHT" => "25"
|
||||
);
|
||||
|
||||
$tasUid = $wp->addTask($data);
|
||||
|
||||
$taskData = $wp->getTask($tasUid);
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$this->assertEquals($data[$key], $taskData[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
*/
|
||||
public function testUpdateTask($wp)
|
||||
{
|
||||
$data = array(
|
||||
"TAS_TITLE" => "task #1 (updated)",
|
||||
"TAS_POSX" => "150",
|
||||
"TAS_POSY" => "250"
|
||||
);
|
||||
|
||||
// at this time, there is only one task
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertInternalType('array', $tasks);
|
||||
$this->assertCount(1, $tasks);
|
||||
|
||||
$wp->updateTask($tasks[0]['TAS_UID'], $data);
|
||||
$taskData = $wp->getTask($tasks[0]['TAS_UID']);
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$this->assertEquals($data[$key], $taskData[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
*/
|
||||
public function testRemoveTask($wp)
|
||||
{
|
||||
$tasUid = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #2",
|
||||
"TAS_POSX" => "150",
|
||||
"TAS_POSY" => "250"
|
||||
));
|
||||
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertInternalType('array', $tasks);
|
||||
$this->assertCount(2, $tasks);
|
||||
|
||||
$wp->removeTask($tasUid);
|
||||
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertInternalType('array', $tasks);
|
||||
$this->assertCount(1, $tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreate
|
||||
*/
|
||||
public function testGetTasks($wp)
|
||||
{
|
||||
$tasUid1 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #2",
|
||||
"TAS_POSX" => "250",
|
||||
"TAS_POSY" => "250"
|
||||
));
|
||||
$tasUid2 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #3",
|
||||
"TAS_POSX" => "350",
|
||||
"TAS_POSY" => "350"
|
||||
));
|
||||
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertInternalType('array', $tasks);
|
||||
$this->assertCount(3, $tasks);
|
||||
|
||||
$wp->removeTask($tasUid1);
|
||||
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertInternalType('array', $tasks);
|
||||
$this->assertCount(2, $tasks);
|
||||
|
||||
$wp->removeTask($tasUid2);
|
||||
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertInternalType('array', $tasks);
|
||||
$this->assertCount(1, $tasks);
|
||||
|
||||
$wp->removeTask($tasks[0]['TAS_UID']);
|
||||
|
||||
$tasks = $wp->getTasks();
|
||||
$this->assertInternalType('array', $tasks);
|
||||
$this->assertCount(0, $tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function testAddRoute()
|
||||
{
|
||||
$wp = new Project\Workflow(array(
|
||||
"PRO_TITLE" => "Test Project #2 (Sequential)",
|
||||
"PRO_CREATE_USER" => "00000000000000000000000000000001"
|
||||
));
|
||||
|
||||
self::$proUids[] = $wp->getUid();
|
||||
|
||||
$tasUid1 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #1",
|
||||
"TAS_POSX" => "410",
|
||||
"TAS_POSY" => "61"
|
||||
));
|
||||
$tasUid2 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #2",
|
||||
"TAS_POSX" => "159",
|
||||
"TAS_POSY" => "370"
|
||||
));
|
||||
|
||||
$rouUid = $wp->addRoute($tasUid1, $tasUid2, "SEQUENTIAL");
|
||||
|
||||
$routeSaved = $wp->getRoute($rouUid);
|
||||
|
||||
$this->assertEquals($tasUid1, $routeSaved['TAS_UID']);
|
||||
$this->assertEquals($tasUid2, $routeSaved['ROU_NEXT_TASK']);
|
||||
$this->assertEquals("SEQUENTIAL", $routeSaved['ROU_TYPE']);
|
||||
}
|
||||
|
||||
public function testAddSelectRoute()
|
||||
{
|
||||
$wp = new Project\Workflow(array(
|
||||
"PRO_TITLE" => "Test Project #3 (Select)",
|
||||
"PRO_CREATE_USER" => "00000000000000000000000000000001"
|
||||
));
|
||||
self::$proUids[] = $wp->getUid();
|
||||
|
||||
$tasUid1 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #1",
|
||||
"TAS_POSX" => "410",
|
||||
"TAS_POSY" => "61"
|
||||
));
|
||||
$tasUid2 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #2",
|
||||
"TAS_POSX" => "159",
|
||||
"TAS_POSY" => "370"
|
||||
));
|
||||
$tasUid3 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #3",
|
||||
"TAS_POSX" => "670",
|
||||
"TAS_POSY" => "372"
|
||||
));
|
||||
|
||||
$wp->addSelectRoute($tasUid1, array($tasUid2, $tasUid3));
|
||||
}
|
||||
|
||||
public function testCompleteWorkflowProject()
|
||||
{
|
||||
$wp = new Project\Workflow(array(
|
||||
"PRO_TITLE" => "Test Complete Project #4",
|
||||
"PRO_CREATE_USER" => "00000000000000000000000000000001"
|
||||
));
|
||||
|
||||
$tasUid1 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #1",
|
||||
"TAS_POSX" => "406",
|
||||
"TAS_POSY" => "71"
|
||||
));
|
||||
$tasUid2 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #2",
|
||||
"TAS_POSX" => "188",
|
||||
"TAS_POSY" => "240"
|
||||
));
|
||||
$tasUid3 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #3",
|
||||
"TAS_POSX" => "406",
|
||||
"TAS_POSY" => "239"
|
||||
));
|
||||
$tasUid4 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #4",
|
||||
"TAS_POSX" => "294",
|
||||
"TAS_POSY" => "366"
|
||||
));
|
||||
$tasUid5 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #5",
|
||||
"TAS_POSX" => "640",
|
||||
"TAS_POSY" => "240"
|
||||
));
|
||||
$tasUid6 = $wp->addTask(array(
|
||||
"TAS_TITLE" => "task #6",
|
||||
"TAS_POSX" => "640",
|
||||
"TAS_POSY" => "359"
|
||||
));
|
||||
|
||||
|
||||
$wp->addRoute($tasUid1, $tasUid2, "PARALLEL");
|
||||
$wp->addRoute($tasUid1, $tasUid3, "PARALLEL");
|
||||
$wp->addRoute($tasUid1, $tasUid5, "PARALLEL");
|
||||
|
||||
$wp->addRoute($tasUid2, $tasUid4, "SEC-JOIN");
|
||||
$wp->addRoute($tasUid3, $tasUid4, "SEC-JOIN");
|
||||
|
||||
$wp->addRoute($tasUid5, $tasUid6, "EVALUATE");
|
||||
$wp->addRoute($tasUid5, "-1", "EVALUATE");
|
||||
|
||||
$wp->setStartTask($tasUid1);
|
||||
|
||||
$wp->setEndTask($tasUid4);
|
||||
$wp->setEndTask($tasUid6);
|
||||
|
||||
return $wp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCompleteWorkflowProject
|
||||
* @param $wp \ProcessMaker\Project\Workflow
|
||||
* @expectedException \ProcessMaker\Exception\ProjectNotFound
|
||||
* @expectedExceptionCode 20
|
||||
*/
|
||||
public function testRemove($wp)
|
||||
{
|
||||
$proUid = $wp->getUid();
|
||||
$wp->remove();
|
||||
|
||||
Project\Workflow::load($proUid);
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Util;
|
||||
|
||||
|
||||
use ProcessMaker\Util;
|
||||
|
||||
/**
|
||||
* Class XmlExporterTest
|
||||
*
|
||||
* @package Tests\ProcessMaker\Project
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
class XmlExporterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testGetLastVersion()
|
||||
{
|
||||
$lastVer = Util\Common::getLastVersion(__DIR__."/../../fixtures/files_struct/first/sample-*.txt");
|
||||
$this->assertEquals(3, $lastVer);
|
||||
}
|
||||
|
||||
function testGetLastVersionSec()
|
||||
{
|
||||
$lastVer = Util\Common::getLastVersion(__DIR__."/../../fixtures/files_struct/second/sample-*.txt");
|
||||
|
||||
$this->assertEquals(5, $lastVer);
|
||||
}
|
||||
|
||||
function testGetLastVersionThr()
|
||||
{
|
||||
$lastVer = Util\Common::getLastVersion(__DIR__."/../../fixtures/files_struct/third/sample-*.txt");
|
||||
|
||||
$this->assertEquals("3.1.9", $lastVer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Negative test, no matched files found
|
||||
*/
|
||||
function testGetLastVersionOther()
|
||||
{
|
||||
$lastVer = Util\Common::getLastVersion(sys_get_temp_dir()."/sample-*.txt");
|
||||
|
||||
$this->assertEquals(0, $lastVer);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
include "pm-bootstrap.php";
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
pm_home_dir = "/Users/erik/devel/colosa/processmaker"
|
||||
workspace = workflow
|
||||
lang = en
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1 +0,0 @@
|
||||
file sample-1.txt
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// pm-bootstrap.php
|
||||
//
|
||||
|
||||
/*
|
||||
* PmBootstrap for Test Unit Suite
|
||||
*
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*/
|
||||
|
||||
$config = parse_ini_file(__DIR__ . DIRECTORY_SEPARATOR . "config.ini");
|
||||
|
||||
$workspace = $config['workspace'];
|
||||
$lang = $config['lang'];
|
||||
$processMakerHome = $config['pm_home_dir'];
|
||||
$rootDir = realpath($processMakerHome) . DIRECTORY_SEPARATOR;
|
||||
|
||||
require $rootDir . "framework/src/Maveriks/Util/ClassLoader.php";
|
||||
|
||||
$loader = Maveriks\Util\ClassLoader::getInstance();
|
||||
$loader->add($rootDir . 'framework/src/', "Maveriks");
|
||||
$loader->add($rootDir . 'workflow/engine/src/', "ProcessMaker");
|
||||
$loader->add($rootDir . 'workflow/engine/src/');
|
||||
|
||||
// add vendors to autoloader
|
||||
$loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
|
||||
$loader->addClass("Bootstrap", $rootDir . 'gulliver/system/class.bootstrap.php');
|
||||
|
||||
$loader->addModelClassPath($rootDir . "workflow/engine/classes/model/");
|
||||
|
||||
$app = new Maveriks\WebApplication();
|
||||
$app->setRootDir($rootDir);
|
||||
$app->loadEnvironment($workspace);
|
||||
@@ -1,14 +0,0 @@
|
||||
Ext.onReady(function(){
|
||||
location.href = uriReq;
|
||||
|
||||
var hideMask = function () {
|
||||
Ext.get('loading').remove();
|
||||
Ext.fly('loading-mask').fadeOut({
|
||||
remove:true,
|
||||
callback : ''
|
||||
});
|
||||
}
|
||||
|
||||
hideMask.defer(250);
|
||||
|
||||
});
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* functional.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
// guess current application
|
||||
if (!isset($app))
|
||||
{
|
||||
$traces = debug_backtrace();
|
||||
$caller = $traces[0];
|
||||
$app = array_pop(explode(DIRECTORY_SEPARATOR, dirname($caller['file'])));
|
||||
}
|
||||
|
||||
// define symfony constant
|
||||
define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/../..'));
|
||||
define('SF_APP', $app);
|
||||
define('SF_ENVIRONMENT', 'test');
|
||||
define('SF_DEBUG', true);
|
||||
|
||||
// initialize symfony
|
||||
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
|
||||
|
||||
// remove all cache
|
||||
sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* gulliverConstants.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
//***************** URL KEY *********************************************
|
||||
define("URL_KEY", 'c0l0s40pt1mu59r1m3' );
|
||||
|
||||
//***************** System Directories & Paths **************************
|
||||
define('PATH_SEP', '/');
|
||||
|
||||
define( 'PATH_HOME', '/opt/processmaker/trunk/workflow/' );
|
||||
define( 'PATH_GULLIVER_HOME', '/opt/processmaker/trunk/gulliver' . PATH_SEP );
|
||||
//define( 'PATH_GULLIVER_HOME', $pathTrunk . 'gulliver' . PATH_SEP );
|
||||
define( 'PATH_RBAC_HOME', $pathTrunk . 'rbac' . PATH_SEP );
|
||||
define( 'PATH_DATA', '/shared/workflow_data/');
|
||||
|
||||
// the other directories
|
||||
define( 'PATH_GULLIVER', PATH_GULLIVER_HOME . 'system' . PATH_SEP ); //gulliver system classes
|
||||
define( 'PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP );
|
||||
define( 'PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP );
|
||||
define( 'PATH_RBAC', PATH_RBAC_HOME . 'engine/classes' . PATH_SEP ); //to enable rbac version 2
|
||||
define( 'PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP );
|
||||
|
||||
// Application's General Directories
|
||||
define( 'PATH_CORE', PATH_HOME . 'engine' . PATH_SEP );
|
||||
define( 'PATH_SKINS', PATH_CORE . 'skins' . PATH_SEP );
|
||||
define( 'PATH_METHODS', PATH_CORE . 'methods' . PATH_SEP );
|
||||
define( 'PATH_XMLFORM', PATH_CORE . 'xmlform' . PATH_SEP );
|
||||
|
||||
//************ include Gulliver Class **************
|
||||
require_once( PATH_GULLIVER . PATH_SEP . 'class.g.php');
|
||||
|
||||
// the Compiled Directories
|
||||
define( 'PATH_C', $pathOutTrunk . 'compiled/');
|
||||
|
||||
// the Smarty Directories
|
||||
if ( strstr ( getenv ( 'OS' ), 'Windows' ) ) {
|
||||
define( 'PATH_SMARTY_C', 'c:/tmp/smarty/c' );
|
||||
define( 'PATH_SMARTY_CACHE', 'c:/tmp/smarty/cache' );
|
||||
}
|
||||
else {
|
||||
define( 'PATH_SMARTY_C', PATH_C . 'smarty/c' );
|
||||
define( 'PATH_SMARTY_CACHE', PATH_C . 'smarty/cache' );
|
||||
}
|
||||
|
||||
if (!is_dir(PATH_SMARTY_C)) G::mk_dir(PATH_SMARTY_C);
|
||||
if (!is_dir(PATH_SMARTY_CACHE)) G::mk_dir(PATH_SMARTY_CACHE);
|
||||
|
||||
|
||||
// Other Paths
|
||||
//define( 'PATH_DB' , PATH_HOME . 'engine' . PATH_SEP . 'db' . PATH_SEP);
|
||||
define( 'PATH_DB' , PATH_DATA . 'sites' . PATH_SEP );
|
||||
define( 'PATH_RTFDOCS' , PATH_CORE . 'rtf_templates' . PATH_SEP );
|
||||
define( 'PATH_HTMLMAIL', PATH_CORE . 'html_templates' . PATH_SEP );
|
||||
define( 'PATH_TPL' , PATH_CORE . 'templates' . PATH_SEP );
|
||||
define( 'PATH_DYNACONT', PATH_CORE . 'content' . PATH_SEP . 'dynaform' . PATH_SEP );
|
||||
define( 'PATH_LANGUAGECONT', PATH_CORE . 'content' . PATH_SEP . 'languages' . PATH_SEP );
|
||||
define( 'SYS_UPLOAD_PATH', PATH_HOME . "public_html/files/" );
|
||||
define( 'PATH_UPLOAD', PATH_HTML . 'files/');
|
||||
|
||||
|
||||
define ('DB_HOST', '192.168.0.10' );
|
||||
define ('DB_NAME', 'wf_opensource' );
|
||||
define ('DB_USER', 'fluid' );
|
||||
define ('DB_PASS', 'fluid2000' );
|
||||
define ('DB_RBAC_NAME', 'rbac_os' );
|
||||
define ('DB_RBAC_USER', 'rbac_os' );
|
||||
define ('DB_RBAC_PASS', '873821w3n2u719tx' );
|
||||
define ('DB_WIZARD_REPORT_SYS', 'report_os' );
|
||||
define ('DB_WIZARD_REPORT_USER', 'rep_os' );
|
||||
define ('DB_WIZARD_REPORT_PASS', '3r357ichy6b95s88' );
|
||||
|
||||
define ( 'SF_ROOT_DIR', PATH_CORE );
|
||||
define ( 'SF_APP', 'app' );
|
||||
define ( 'SF_ENVIRONMENT', 'env' );
|
||||
|
||||
set_include_path(
|
||||
PATH_THIRDPARTY . PATH_SEPARATOR .
|
||||
PATH_THIRDPARTY . 'pear' . PATH_SEPARATOR .
|
||||
get_include_path()
|
||||
);
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* unit.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
ini_set('short_open_tag', 'on');
|
||||
ini_set('asp_tags', 'on');
|
||||
ini_set('memory_limit', '80M');
|
||||
|
||||
if ( PHP_OS == 'WINNT' )
|
||||
define('PATH_SEP', '\\');
|
||||
else
|
||||
define('PATH_SEP', '/');
|
||||
|
||||
|
||||
//***************** Defining the Home Directory *********************************
|
||||
$docuroot = explode ( PATH_SEP , $_SERVER['PWD'] );
|
||||
array_pop($docuroot);
|
||||
$pathhome = implode( PATH_SEP, $docuroot );
|
||||
define('PATH_HOME', $pathhome . PATH_SEP );
|
||||
$gulliverConfig = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php';
|
||||
$definesConfig = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'defines.php';
|
||||
|
||||
//try to find automatically the trunk directory where are placed the RBAC and Gulliver directories
|
||||
//in a normal installation you don't need to change it.
|
||||
array_pop($docuroot);
|
||||
$pathTrunk = implode( PATH_SEP, $docuroot ) . PATH_SEP ;
|
||||
array_pop($docuroot);
|
||||
$pathOutTrunk = implode( PATH_SEP, $docuroot ) . PATH_SEP ;
|
||||
// to do: check previous algorith for Windows $pathTrunk = "c:/home/";
|
||||
|
||||
define('PATH_TRUNK', $pathTrunk );
|
||||
define('PATH_OUTTRUNK', $pathOutTrunk );
|
||||
|
||||
if (file_exists( $gulliverConfig )) {
|
||||
include ( $gulliverConfig );
|
||||
}
|
||||
|
||||
if (file_exists( $definesConfig )) {
|
||||
include ( $definesConfig );
|
||||
}
|
||||
|
||||
//$_test_dir = realpath(dirname(__FILE__).'/..');
|
||||
//require_once( 'lime/lime.php');
|
||||
if(file_exists(PATH_GULLIVER . "class.bootstrap.php")) {
|
||||
require_once (PATH_GULLIVER . "class.bootstrap.php");
|
||||
}
|
||||
spl_autoload_register(array('Bootstrap', 'autoloadClass'));
|
||||
Bootstrap::registerClass('G', PATH_GULLIVER . "class.g.php");
|
||||
Bootstrap::registerClass('System', PATH_HOME . "engine/classes/class.system.php");
|
||||
// Call more Classes
|
||||
Bootstrap::registerClass('headPublisher', PATH_GULLIVER . "class.headPublisher.php");
|
||||
Bootstrap::registerClass('publisher', PATH_GULLIVER . "class.publisher.php");
|
||||
Bootstrap::registerClass('xmlform', PATH_GULLIVER . "class.xmlform.php");
|
||||
Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
|
||||
Bootstrap::registerClass('xmlformExtension', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
Bootstrap::registerClass('form', PATH_GULLIVER . "class.form.php");
|
||||
Bootstrap::registerClass('menu', PATH_GULLIVER . "class.menu.php");
|
||||
Bootstrap::registerClass('Xml_Document', PATH_GULLIVER . "class.xmlDocument.php");
|
||||
Bootstrap::registerClass('DBSession', PATH_GULLIVER . "class.dbsession.php");
|
||||
Bootstrap::registerClass('DBConnection', PATH_GULLIVER . "class.dbconnection.php");
|
||||
Bootstrap::registerClass('DBRecordset', PATH_GULLIVER . "class.dbrecordset.php");
|
||||
Bootstrap::registerClass('DBTable', PATH_GULLIVER . "class.dbtable.php");
|
||||
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
|
||||
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
|
||||
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
|
||||
Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php");
|
||||
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||
Bootstrap::registerClass('Propel', PATH_THIRDPARTY . "propel/Propel.php");
|
||||
Bootstrap::registerClass('Creole', PATH_THIRDPARTY . "creole/Creole.php");
|
||||
Bootstrap::registerClass('Criteria', PATH_THIRDPARTY . "propel/util/Criteria.php");
|
||||
Bootstrap::registerClass('Groups', PATH_HOME . "engine/classes/class.groups.php");
|
||||
Bootstrap::registerClass('Tasks', PATH_HOME . "engine/classes/class.tasks.php");
|
||||
Bootstrap::registerClass('Calendar', PATH_HOME . "engine/classes/class.calendar.php");
|
||||
Bootstrap::registerClass('processMap', PATH_HOME . "engine/classes/class.processMap.php");
|
||||
|
||||
Bootstrap::registerSystemClasses();
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeFunction.php');
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeGetopt.class.php');
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
if ( !defined ( 'G_ENVIRONMENT') )
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV );
|
||||
|
||||
40
workflow/engine/test/fixtures/appDelegation.yml
vendored
40
workflow/engine/test/fixtures/appDelegation.yml
vendored
@@ -1,40 +0,0 @@
|
||||
CreateAppDelegations:
|
||||
-
|
||||
Title: "Create AppDelegation with Empty $Fields"
|
||||
Function: "CreateEmptyAppDelegation"
|
||||
Input:
|
||||
Output:
|
||||
Type: "G_Error"
|
||||
-
|
||||
Title: "Create Duplicated AppDelegation"
|
||||
Function: "CreateDuplicated"
|
||||
Input:
|
||||
APP_UID: "1DUPLICATED1"
|
||||
DEL_INDEX: 2
|
||||
PRO_UID[]: "guid.pm"
|
||||
TAS_UID[]: "guid.pm"
|
||||
Output:
|
||||
Type: "G_Error"
|
||||
-
|
||||
TODO: "Review: Error catch in CreateAppDelegation capture Propel Errors but return the same G_Error information."
|
||||
-
|
||||
Title: "Create random new AppDelegation"
|
||||
Function: "CreateNewAppDelegation"
|
||||
Input:
|
||||
APP_UID[]: "guid.pm"
|
||||
DEL_INDEX[]: "rand.number"
|
||||
PRO_UID[]: "guid.pm"
|
||||
TAS_UID[]: "guid.pm"
|
||||
DEL_TYPE[]: "*.DEL_TYPE.pm"
|
||||
DEL_THREAD_STATUS[]: "*.DEL_THREAD_STATUS.pm"
|
||||
Output:
|
||||
Type: "string"
|
||||
-
|
||||
TODO: "Review: There isn't a 'function delete'. Is it required?"
|
||||
DeleteCretedAppDelegations:
|
||||
-
|
||||
Title: "Deleting created AppDelegations"
|
||||
Input:
|
||||
Fields[]:"*.createdAppDel"
|
||||
Output:
|
||||
Value: "true"
|
||||
100
workflow/engine/test/fixtures/appDocument.yml
vendored
100
workflow/engine/test/fixtures/appDocument.yml
vendored
@@ -1,100 +0,0 @@
|
||||
load1:
|
||||
-
|
||||
Title: "Obtain the application document data"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
APP_DOC_UID: "1"
|
||||
Output:
|
||||
Type: "array"
|
||||
load2:
|
||||
-
|
||||
Title: "Obtain the application document data (not existent)"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
APP_DOC_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
create1:
|
||||
-
|
||||
Title: "Create the application document data"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
APP_DOC_UID: "2"
|
||||
APP_UID: "2"
|
||||
DEL_INDEX: "2"
|
||||
DOC_UID: "2"
|
||||
USR_UID: "2"
|
||||
APP_DOC_TYPE: "INPUT"
|
||||
APP_DOC_CREATE_DATE: "2007-12-31 23:59:59"
|
||||
APP_DOC_TITLE: "APP_DOC_TITLE"
|
||||
APP_DOC_COMMENT: "APP_DOC_COMMENT"
|
||||
APP_DOC_FILENAME: "APP_DOC_FILENAME"
|
||||
Output:
|
||||
Type: "integer"
|
||||
create2:
|
||||
-
|
||||
Title: "Create the application document data (whit incomplete data)"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
APP_DOC_UID: ""
|
||||
APP_UID: "2"
|
||||
DEL_INDEX: "2"
|
||||
DOC_UID: "2"
|
||||
USR_UID: "2"
|
||||
APP_DOC_TYPE: "INPUT"
|
||||
APP_DOC_CREATE_DATE: "2007-12-31 23:59:59"
|
||||
APP_DOC_TITLE: "APP_DOC_TITLE"
|
||||
APP_DOC_COMMENT: "APP_DOC_COMMENT"
|
||||
APP_DOC_FILENAME: "APP_DOC_FILENAME"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
update1:
|
||||
-
|
||||
Title: "Update the application document data"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
APP_DOC_UID: "1"
|
||||
APP_UID: "2"
|
||||
DEL_INDEX: "2"
|
||||
DOC_UID: "2"
|
||||
USR_UID: "2"
|
||||
APP_DOC_TYPE: "OUTPUT"
|
||||
APP_DOC_CREATE_DATE: "2008-01-01 00:00:00"
|
||||
APP_DOC_TITLE: "APP_DOC_TITLE1"
|
||||
APP_DOC_COMMENT: "APP_DOC_COMMENT1"
|
||||
APP_DOC_FILENAME: "APP_DOC_FILENAME1"
|
||||
Output:
|
||||
Type: "integer"
|
||||
update2:
|
||||
-
|
||||
Title: "Update the application document data (not existent)"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
APP_DOC_UID: "111111111111"
|
||||
APP_UID: "2"
|
||||
DEL_INDEX: "2"
|
||||
DOC_UID: "2"
|
||||
USR_UID: "2"
|
||||
APP_DOC_TYPE: "OUTPUT"
|
||||
APP_DOC_CREATE_DATE: "2008-01-01 00:00:00"
|
||||
APP_DOC_TITLE: "APP_DOC_TITLE1"
|
||||
APP_DOC_COMMENT: "APP_DOC_COMMENT1"
|
||||
APP_DOC_FILENAME: "APP_DOC_FILENAME1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
remove1:
|
||||
-
|
||||
Title: "Remove the application document data"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
APP_DOC_UID: "2"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
remove2:
|
||||
-
|
||||
Title: "Remove the application document data (not existent)"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
APP_DOC_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
10
workflow/engine/test/fixtures/application.yml
vendored
10
workflow/engine/test/fixtures/application.yml
vendored
@@ -1,10 +0,0 @@
|
||||
fields:
|
||||
PRO_UID: '346FAE3953CC69'
|
||||
APP_PARENT: ''
|
||||
APP_STATUS: 'DRAFT'
|
||||
APP_PROC_STATUS: 'STATUS'
|
||||
APP_PROC_CODE: '12345678'
|
||||
APP_PARALLEL: 'N'
|
||||
APP_INIT_USER: 'ABC123'
|
||||
APP_CUR_USER: 'ABC123'
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
FirstStepTestCases:
|
||||
-
|
||||
Title: "@#Function(): Create some non Parallel Cases"
|
||||
Class: "applicationTest"
|
||||
Instance: $obj
|
||||
Function: "SaveTest"
|
||||
Input:
|
||||
PRO_UID: "8475E6C841051A"
|
||||
APP_PARALLEL: "N"
|
||||
APP_INIT_USER: "@G::generateUniqueID()"
|
||||
APP_CUR_USER: "@G::generateUniqueID()"
|
||||
APP_CREATE_DATE: "@date(Y-m-d)"
|
||||
APP_INIT_DATE: "0000-00-00"
|
||||
APP_FINISH_DATE: "0000-00-00"
|
||||
APP_UPDATE_DATE: "@date(Y-m-d)"
|
||||
APP_STATUS[]:"*.nonParallelStatus.applicationInput"
|
||||
APP_PARENT: "0"
|
||||
APP_PROC_STATUS: ""
|
||||
APP_PROC_CODE: ""
|
||||
Output:
|
||||
Type: "string"
|
||||
-
|
||||
Title: "@#Function(): Create one parallel Case (Force to be parallel)"
|
||||
Class: "applicationTest"
|
||||
Instance: $obj
|
||||
Function: "SaveTest"
|
||||
Input:
|
||||
PRO_UID: "8475E6C841051A"
|
||||
APP_PARALLEL: "Y"
|
||||
APP_STATUS: "PARALLEL"
|
||||
APP_PARENT: "0"
|
||||
APP_PROC_STATUS: ""
|
||||
APP_PROC_CODE: ""
|
||||
APP_INIT_USER: "@G::generateUniqueID()"
|
||||
APP_CUR_USER: "@G::generateUniqueID()"
|
||||
APP_CREATE_DATE: "@date(Y-m-d)"
|
||||
APP_INIT_DATE: "0000-00-00"
|
||||
APP_FINISH_DATE: "0000-00-00"
|
||||
Output:
|
||||
Type: "string"
|
||||
SecondStepTestCases:
|
||||
-
|
||||
Title: "@#Function(): Update one of LastCreatedCases with all diferent types of status"
|
||||
Class: "applicationTest"
|
||||
Instance: $obj
|
||||
Function: "UpdateTest"
|
||||
Input:
|
||||
PRO_UID: "8475E6C841051A"
|
||||
APP_UID[]: "LAST_CREATED_CASE"
|
||||
APP_STATUS[]: "*.APP_STATUS.pm"
|
||||
Output:
|
||||
Type: "string"
|
||||
-
|
||||
Title: "@#Function(): Loads all LastCreatedCases"
|
||||
Class: "applicationTest"
|
||||
Instance: $obj
|
||||
Function: "LoadTest"
|
||||
Input:
|
||||
PRO_UID: "8475E6C841051A"
|
||||
APP_UID[]: "*.LAST_CREATED_CASE"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
-
|
||||
Title: "@#Function(): Delete all LastCreatedCases"
|
||||
Class: "applicationTest"
|
||||
Instance: $obj
|
||||
Function: "DeleteTest"
|
||||
Input:
|
||||
PRO_UID: "8475E6C841051A"
|
||||
APP_UID[]: "*.LAST_CREATED_CASE"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
nonParallelStatus:
|
||||
- "DRAFT"
|
||||
- "CANCEL"
|
||||
47
workflow/engine/test/fixtures/configuration.yml
vendored
47
workflow/engine/test/fixtures/configuration.yml
vendored
@@ -1,47 +0,0 @@
|
||||
CreateTestConfigurations:
|
||||
-
|
||||
Title:"Creating new Configurations"
|
||||
Function:"CreateConfiguration"
|
||||
Input:
|
||||
CFG_UID[]:"guid.pm"
|
||||
OBJ_UID[]:"guid.pm"
|
||||
PRO_UID[]:"guid.pm"
|
||||
USR_UID[]:"guid.pm"
|
||||
APP_UID:""
|
||||
Output:
|
||||
Value: 1
|
||||
ConfigurationUnitTest:
|
||||
-
|
||||
Title:"Updating Configurations"
|
||||
Function:"UpdateConfiguration"
|
||||
Input:
|
||||
CFG_UID[]:"CREATED_UID"
|
||||
OBJ_UID[]:"CREATED_OBJ"
|
||||
PRO_UID[]:"CREATED_PRO"
|
||||
USR_UID[]:"CREATED_USR"
|
||||
APP_UID:""
|
||||
CFG_VALUE[]:"*.text.es"
|
||||
Output:
|
||||
Value: 1
|
||||
-
|
||||
Title:"Loading Configurations"
|
||||
Function:"LoadConfiguration"
|
||||
Input:
|
||||
CFG_UID[]:"CREATED_UID"
|
||||
OBJ_UID[]:"CREATED_OBJ"
|
||||
PRO_UID[]:"CREATED_PRO"
|
||||
USR_UID[]:"CREATED_USR"
|
||||
APP_UID:""
|
||||
Output:
|
||||
Type: "array"
|
||||
-
|
||||
Title:"Removing Configurations"
|
||||
Function:"RemoveConfiguration"
|
||||
Input:
|
||||
CFG_UID[]:"CREATED_UID"
|
||||
OBJ_UID[]:"CREATED_OBJ"
|
||||
PRO_UID[]:"CREATED_PRO"
|
||||
USR_UID[]:"CREATED_USR"
|
||||
APP_UID:""
|
||||
Output:
|
||||
Type: "NULL"
|
||||
71
workflow/engine/test/fixtures/content.yml
vendored
71
workflow/engine/test/fixtures/content.yml
vendored
@@ -1,71 +0,0 @@
|
||||
loadContent:
|
||||
-
|
||||
Title: "LoadContent method"
|
||||
Function: "loadContent"
|
||||
Input:
|
||||
CON_CATEGORY: 'ABC_CATEGORY'
|
||||
CON_PARENT: '1234567890'
|
||||
CON_ID: '6475576C725EA4'
|
||||
CON_LANG: 'it'
|
||||
CON_VALUE: 'Content Example'
|
||||
Output:
|
||||
Type: "string"
|
||||
deleteContent:
|
||||
-
|
||||
Title: "delete a row "
|
||||
Function: "deleteContent"
|
||||
Input:
|
||||
CON_CATEGORY: 'ABC_CATEGORY'
|
||||
CON_PARENT: '1234567890'
|
||||
CON_ID: '6475576C725EA4'
|
||||
CON_LANG: 'it'
|
||||
Output:
|
||||
Type: "NULL"
|
||||
-
|
||||
Title: "delete a row "
|
||||
Function: "deleteContent"
|
||||
Input:
|
||||
CON_CATEGORY: 'ABC_CATEGORY'
|
||||
CON_PARENT: '1234567890'
|
||||
CON_ID: '9876543210'
|
||||
CON_LANG: 'it'
|
||||
Output:
|
||||
Type: "NULL"
|
||||
addContent1:
|
||||
-
|
||||
Title: "addContent method, calling the first time"
|
||||
Function: "addContent"
|
||||
Input:
|
||||
CON_CATEGORY: 'ABC_CATEGORY'
|
||||
CON_PARENT: '1234567890'
|
||||
CON_ID: '9876543210'
|
||||
CON_LANG: 'it'
|
||||
CON_VALUE: 'addContent method, calling the first time'
|
||||
Output:
|
||||
Type: integer
|
||||
addContentTwice:
|
||||
-
|
||||
Title: "validate duplicate row, with the addContent method"
|
||||
Function: "addContent"
|
||||
Input:
|
||||
CON_CATEGORY: 'ABC_CATEGORY'
|
||||
CON_PARENT: '1234567890'
|
||||
CON_ID: '9876543210'
|
||||
CON_LANG: 'it'
|
||||
CON_VALUE: 'validate duplicate row, now update the row'
|
||||
Output:
|
||||
Type: "integer"
|
||||
addContentAcentos:
|
||||
-
|
||||
Title: "add content with acentos"
|
||||
Function: "addContent"
|
||||
Input:
|
||||
CON_CATEGORY: 'ABC_CATEGORY'
|
||||
CON_PARENT: '1234567890'
|
||||
CON_ID: '6475576C725EA4'
|
||||
CON_LANG: 'it'
|
||||
CON_VALUE: '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
||||
Output:
|
||||
Type: "integer"
|
||||
|
||||
|
||||
34
workflow/engine/test/fixtures/departments.txt
vendored
34
workflow/engine/test/fixtures/departments.txt
vendored
@@ -1,34 +0,0 @@
|
||||
ExecutivePresident|
|
||||
Marketing|ExecutivePresident
|
||||
SalesDivision|ExecutivePresident
|
||||
RiskManager|Sales
|
||||
NationalSales|Sales
|
||||
InternationalSales|Sales
|
||||
EuropeSales|InternationalSales
|
||||
USASales|InternationalSales
|
||||
JapanSales|InternationalSales
|
||||
InternetSales|Sales
|
||||
AdministrativeDivision|ExecutivePresident
|
||||
Accounting|AdministrativeDivision
|
||||
HumanResources|AdministrativeDivision
|
||||
InfraestructureManagement|AdministrativeDivision
|
||||
Facilities|InfraestructureManagement
|
||||
VehicleMaintenance|InfraestructureManagement
|
||||
InvestigativeDivision|ExecutivePresident
|
||||
Legal|InvestigativeDivision
|
||||
DetectiveSection|InvestigativeDivision
|
||||
Records|InvestigativeDivision
|
||||
EuropeRegional|
|
||||
SupportServiceDivision|ExecutivePresident
|
||||
InformationDesk|SupportServiceDivision
|
||||
TechnologicalResearch|SupportServiceDivision
|
||||
Landlinetelephony|SupportServiceDivision
|
||||
MobileServices|SupportServiceDivision
|
||||
FinanceDivision|ExecutivePresident
|
||||
PlanningandResearch|FinanceDivision
|
||||
DeputyDirector|FinanceDivision
|
||||
OperacionDivision|ExecutivePresident
|
||||
SystemAdministration|OperacionDivision
|
||||
SecurityOfficer|OperacionDivision
|
||||
OperationandBusiness|OperacionDivision
|
||||
SpecialOperations|OperationandBusiness
|
||||
28
workflow/engine/test/fixtures/derivation.yml
vendored
28
workflow/engine/test/fixtures/derivation.yml
vendored
@@ -1,28 +0,0 @@
|
||||
StartCase1:
|
||||
-
|
||||
Title: "Start a new application @#Function()"
|
||||
Function: "StartCaseTest"
|
||||
Input:
|
||||
TAS_UID: "4475E6C8E10346"
|
||||
USR_UID: "4475E6E07C261E"
|
||||
firstname[]: "@@SYS_LANG"
|
||||
lastname[]: "last.name.es"
|
||||
Output:
|
||||
Type: "array"
|
||||
StartCase2:
|
||||
-
|
||||
Title: "Start a new application (pseudo derivate)"
|
||||
Function: "StartCaseTest"
|
||||
Input:
|
||||
TAS_UID: "4475E6C8E10346"
|
||||
USR_UID: "4475E6E07C261E"
|
||||
Output:
|
||||
Type: "array"
|
||||
DeleteCreatedApplications:
|
||||
-
|
||||
Title: "Delete created applications"
|
||||
Function: "DeleteCase"
|
||||
Input:
|
||||
APP_UID[]: "*.CREATED_APPLICATIONS"
|
||||
Output:
|
||||
Type: "array"
|
||||
34
workflow/engine/test/fixtures/domain.yml
vendored
34
workflow/engine/test/fixtures/domain.yml
vendored
@@ -1,34 +0,0 @@
|
||||
pm:
|
||||
APP_STATUS:
|
||||
- "DRAFT"
|
||||
- "CANCEL"
|
||||
- "PARALLEL"
|
||||
DEL_TYPE:
|
||||
- "NORMAL"
|
||||
DEL_THREAD_STATUS:
|
||||
- "OPEN"
|
||||
- "CLOSED"
|
||||
yesno:
|
||||
- "Y"
|
||||
- "N"
|
||||
guid:
|
||||
- "@G::generateUniqueID()"
|
||||
stepUidObj:
|
||||
- "DYNAFORM"
|
||||
- "INPUT_DOCUMENT"
|
||||
- "MESSAGE"
|
||||
- "OUTPUT_DOCUMENT"
|
||||
date:
|
||||
today:
|
||||
- "@date(Y-m-d)"
|
||||
time:
|
||||
today:
|
||||
- "@date(H:i:s)"
|
||||
datetime:
|
||||
today:
|
||||
- "@date(Y-m-d H:i:s)"
|
||||
number:
|
||||
percentage:
|
||||
- "@eval(return rand(0,100\))"
|
||||
rand:
|
||||
-"@rand()"
|
||||
59
workflow/engine/test/fixtures/es.yml
vendored
59
workflow/engine/test/fixtures/es.yml
vendored
@@ -1,59 +0,0 @@
|
||||
name:
|
||||
first:
|
||||
- David
|
||||
- Julio
|
||||
- Mauricio
|
||||
- Wilmer
|
||||
- Fernando
|
||||
- Hugo
|
||||
- Ramiro
|
||||
last:
|
||||
- Callizaya
|
||||
- Avendaño
|
||||
- Veliz
|
||||
- Maborak
|
||||
- Ontiveros
|
||||
- Loza
|
||||
- Cuentas
|
||||
group:
|
||||
- Administración
|
||||
- Consultores
|
||||
- Desarrollo
|
||||
- Gerencia
|
||||
- Ventas
|
||||
- Business Development
|
||||
- Redes y Servidores
|
||||
- Soporte y Entrenamiento
|
||||
- Otros
|
||||
text:
|
||||
- ¿Por qué la ciencia se empeña en comprender el universo si todavia no comprende al ser humano?
|
||||
- Tengo una demostración maravillosa...
|
||||
- La ciencia es la verdadera sabiduría.
|
||||
- El verdadero amante de la vida es el cientifico, pues es el único que se ocupa de descubrir sus misterios.
|
||||
- El conocimiento es patrimonio de la humanidad, no es solo tuyo, trasmítelo para beneficio de toda la humanidad.
|
||||
- La ciencia es la necesidad de demostrar lo que nos acontece.
|
||||
- Cada uno de nosotros es un modelo totalmente nuevo, parecido a otros modelos pero totalmente diferente.
|
||||
- ¿Por qué las moras negras están rojas cuando están verdes?
|
||||
- La ciencia es la manera estadísticamente correcta de contar novelas.
|
||||
- La ciencia de vivir es el arte de amar.
|
||||
- La ciencia es la explicación de lo inexplicable.
|
||||
- Un ser humano es algo más que la suma de sus genes.
|
||||
- La ciencia es el idioma del hombre.
|
||||
- La ciencia me dió lo que soy, un buen hombre. La ciencia me ayudará a ayudar a las personas.
|
||||
- Para ser científico debo afirmar lo que veo y negar lo que creo.
|
||||
- La ciencia es el arte de bosquejar para los demás los fenómenos de la naturaleza...
|
||||
- La ciencia es el instrumento más poderoso de la humanidad.
|
||||
html:
|
||||
- "<p> <b>Hola Mundo!!</b></p>"
|
||||
- "<p> <u>áéíóú</u></p>"
|
||||
- "<p>'hola Mundo!!' <script>alert('Hola Bug!!')</script></p>"
|
||||
email:
|
||||
- "davidsantos@colosa.com"
|
||||
- "juliocesar@colosa.com"
|
||||
- "mauricio@colosa.com"
|
||||
- "wilmer@colosa.com"
|
||||
address:
|
||||
- "Dom - 2453416 Dom. Padres"
|
||||
zip:
|
||||
- "00000"
|
||||
- "52412"
|
||||
501
workflow/engine/test/fixtures/firstname.txt
vendored
501
workflow/engine/test/fixtures/firstname.txt
vendored
@@ -1,501 +0,0 @@
|
||||
|
||||
Amy
|
||||
Sidney
|
||||
Matt
|
||||
Robert
|
||||
Michael
|
||||
Josh
|
||||
Lori
|
||||
Dorothy
|
||||
Tavon
|
||||
Corey
|
||||
Clarissa
|
||||
Tony
|
||||
Terry
|
||||
Arlene
|
||||
Alex
|
||||
Jim
|
||||
mike
|
||||
max
|
||||
Jacob
|
||||
Armand
|
||||
Joshua
|
||||
Ava
|
||||
Olivia
|
||||
Sophia
|
||||
William
|
||||
Christopher
|
||||
Matthew
|
||||
Samantha
|
||||
Andrew
|
||||
Joseph
|
||||
David
|
||||
Alexis
|
||||
Alyssa
|
||||
James
|
||||
Ryan
|
||||
Ella
|
||||
Sarah
|
||||
Taylor
|
||||
Lily
|
||||
Benjamin
|
||||
Nathan
|
||||
Ulices
|
||||
Grace
|
||||
Brianna
|
||||
Gavin
|
||||
Dylan
|
||||
Brandon
|
||||
Caleb
|
||||
Mason
|
||||
Angel
|
||||
Isaac
|
||||
Evan
|
||||
Jack
|
||||
Kevin
|
||||
Jose
|
||||
Isaiah
|
||||
Luke
|
||||
Landon
|
||||
Justin
|
||||
Lucas
|
||||
Zachary
|
||||
Jordan
|
||||
Arthur
|
||||
Aaron
|
||||
Brayden
|
||||
Thomas
|
||||
Cameron
|
||||
Hunter
|
||||
Austin
|
||||
Adrian
|
||||
Connor
|
||||
Owen
|
||||
Aidan
|
||||
Jason
|
||||
Julian
|
||||
Wyatt
|
||||
Charles
|
||||
Carter
|
||||
Juan
|
||||
Chase
|
||||
Diego
|
||||
Jeremiah
|
||||
Brody
|
||||
Xavier
|
||||
Adam
|
||||
Sebastian
|
||||
Haydens
|
||||
Nathaniel
|
||||
Jesus
|
||||
Ian
|
||||
Tristan
|
||||
Bryan
|
||||
Sean
|
||||
Cole
|
||||
Jennifer
|
||||
Melanie
|
||||
Gianna
|
||||
Charlotte
|
||||
Paige
|
||||
Isabel
|
||||
Gracie
|
||||
Haley
|
||||
Mya
|
||||
Michelle
|
||||
Molly
|
||||
Stephanie
|
||||
Nicole
|
||||
Jenna
|
||||
Natalia
|
||||
Sadie
|
||||
Jada
|
||||
Ruby
|
||||
Jayla
|
||||
Lydia
|
||||
Bella
|
||||
Haydden
|
||||
Miley
|
||||
Laila
|
||||
Reagan
|
||||
Collin
|
||||
Gage
|
||||
Emmanuel
|
||||
Kendall
|
||||
Liliana
|
||||
Jacqueline
|
||||
Reese
|
||||
Marissa
|
||||
Juliana
|
||||
Tanner
|
||||
Malachi
|
||||
Fernando
|
||||
Cesar
|
||||
Javier
|
||||
Miles
|
||||
Jaiden
|
||||
Edwin
|
||||
Travis
|
||||
Bryson
|
||||
Jace
|
||||
Kaiden
|
||||
Wesley
|
||||
Jeffrey
|
||||
Roman
|
||||
Brendan
|
||||
Maddox
|
||||
Donovan
|
||||
Rylan
|
||||
Dalton
|
||||
Harrison
|
||||
Andre
|
||||
Keegan
|
||||
Sawyer
|
||||
Clayton
|
||||
Zane
|
||||
Gregory
|
||||
Rafael
|
||||
Ezekiel
|
||||
Griffin
|
||||
ny
|
||||
Mateo
|
||||
Braylon
|
||||
Cash
|
||||
Maximus
|
||||
Simon
|
||||
Corbin
|
||||
Brennan
|
||||
Skylers
|
||||
Xander
|
||||
Jaxson
|
||||
Kameron
|
||||
Kyler
|
||||
Elias
|
||||
Harper
|
||||
Ivy
|
||||
Camille
|
||||
Savanna
|
||||
Emely
|
||||
Kiley
|
||||
Kailey
|
||||
Miriam
|
||||
Rihanna
|
||||
Georgia
|
||||
Harmony
|
||||
Kiera
|
||||
Monica
|
||||
Bethany
|
||||
Kaylie
|
||||
Camron
|
||||
Alice
|
||||
Maddison
|
||||
Ximena
|
||||
April
|
||||
Marely
|
||||
Julie
|
||||
Danica
|
||||
Presley
|
||||
Brielle
|
||||
Julissa
|
||||
Angie
|
||||
Hazel
|
||||
Rose
|
||||
Malia
|
||||
Shayla
|
||||
Fiona
|
||||
Phoebe
|
||||
Nayeli
|
||||
Jaya
|
||||
Ruth
|
||||
Janiya
|
||||
Denise
|
||||
Holly
|
||||
Hanna
|
||||
Tatum
|
||||
Marlee
|
||||
Nataly
|
||||
Lizbeth
|
||||
Serena
|
||||
Anya
|
||||
Jaslene
|
||||
Kaylin
|
||||
Greyson
|
||||
Jameson
|
||||
Everett
|
||||
Jayce
|
||||
Darren
|
||||
Elliott
|
||||
Uriel
|
||||
Hugo
|
||||
Marshall
|
||||
Nickolas
|
||||
Bryant
|
||||
Maurice
|
||||
Russell
|
||||
Leland
|
||||
Davis
|
||||
Reed
|
||||
Kade
|
||||
Reece
|
||||
Morgan
|
||||
Ramon
|
||||
Rocco
|
||||
Orlando
|
||||
Ryker
|
||||
Brodie
|
||||
Paxton
|
||||
Jacoby
|
||||
Macie
|
||||
Lyric
|
||||
Logan
|
||||
Lana
|
||||
Kaned
|
||||
Alvin
|
||||
Shaun
|
||||
Eddie
|
||||
Kane
|
||||
Davion
|
||||
Zachariah
|
||||
Dorian
|
||||
Kellen
|
||||
Micaela
|
||||
Isiah
|
||||
Javon
|
||||
Nasir
|
||||
Milo
|
||||
Anahi
|
||||
Alissa
|
||||
Anaya
|
||||
Ainsley
|
||||
Noelle
|
||||
Meredith
|
||||
Kailyn
|
||||
Johanna
|
||||
Evangeline
|
||||
Kathleen
|
||||
Juliet
|
||||
Meghan
|
||||
Paisley
|
||||
Athena
|
||||
Hailee
|
||||
Emilee
|
||||
Sage
|
||||
Alanna
|
||||
Elaina
|
||||
Nia
|
||||
Kasey
|
||||
Paris
|
||||
Casey
|
||||
Dana
|
||||
Aubrie
|
||||
Kaitlin
|
||||
Norah
|
||||
Lauryn
|
||||
Perla
|
||||
Amiyah
|
||||
Lillie
|
||||
Danika
|
||||
Heather
|
||||
Kassidy
|
||||
Taryn
|
||||
Tori
|
||||
Francesca
|
||||
Kristen
|
||||
Amya
|
||||
Elle
|
||||
Craig
|
||||
Ibrahim
|
||||
Osvaldo
|
||||
Wade
|
||||
Harley
|
||||
Steve
|
||||
Davin
|
||||
Deshawn
|
||||
Kason
|
||||
Damion
|
||||
Jaylon
|
||||
Jefferson
|
||||
Aron
|
||||
Brooks
|
||||
Darian
|
||||
Gerald
|
||||
Rolando
|
||||
Terrence
|
||||
Enzo
|
||||
Kian
|
||||
Ryland
|
||||
Barrett
|
||||
Jaeden
|
||||
Ben
|
||||
Bradyn
|
||||
Giovani
|
||||
Blaine
|
||||
Madden
|
||||
Jerome
|
||||
Muhamma
|
||||
Ronnie
|
||||
Layne
|
||||
Kolby
|
||||
Leonard
|
||||
Vicente
|
||||
Cale
|
||||
Alessandro
|
||||
Zachery
|
||||
Gavyn
|
||||
Aydin
|
||||
Xzavier
|
||||
Malakai
|
||||
Raphael
|
||||
Cannon
|
||||
Rudy
|
||||
Asa
|
||||
Darrell
|
||||
Giancarlo
|
||||
Elisha
|
||||
Junior
|
||||
Zackery
|
||||
Alvaro
|
||||
Lewis
|
||||
Valentin
|
||||
Deacon
|
||||
Jase
|
||||
Harry
|
||||
Rashad
|
||||
Finnegan
|
||||
Mohammed
|
||||
Ramiro
|
||||
Cedric
|
||||
Brennen
|
||||
Santino
|
||||
Stanley
|
||||
Tyrone
|
||||
Chace
|
||||
Francis
|
||||
athon
|
||||
Teagan
|
||||
Zechariah
|
||||
Alonso
|
||||
Kaeden
|
||||
Kamden
|
||||
Gilberto
|
||||
Ray
|
||||
Karter
|
||||
Luciano
|
||||
Nico
|
||||
Kole
|
||||
Aryan
|
||||
Draven
|
||||
Jamie
|
||||
Misael
|
||||
Lee
|
||||
Alexzanders
|
||||
Camren
|
||||
Giovanny
|
||||
Amare
|
||||
Rhett
|
||||
Rhys
|
||||
Rodolfo
|
||||
Nash
|
||||
Markus
|
||||
Deven
|
||||
Mohammad
|
||||
Moshe
|
||||
Quintin
|
||||
Dwayne
|
||||
Memphis
|
||||
Atticus
|
||||
Davian
|
||||
Eugene
|
||||
Jax
|
||||
Antoine
|
||||
Wayne
|
||||
Randall
|
||||
Semaj
|
||||
Uriah
|
||||
Clark
|
||||
Aidyn
|
||||
Jorden
|
||||
Maxim
|
||||
Aditya
|
||||
Lawson
|
||||
Messiah
|
||||
Korbin
|
||||
Sullivan
|
||||
Freddy
|
||||
Demarcus
|
||||
Neil
|
||||
Brice
|
||||
King
|
||||
Davon
|
||||
Elvis
|
||||
Ace
|
||||
Dexter
|
||||
Heath
|
||||
Duncan
|
||||
Jamar
|
||||
Sincere
|
||||
Irvin
|
||||
Remingtons
|
||||
Kadin
|
||||
Soren
|
||||
Tyree
|
||||
Damarion
|
||||
Talan
|
||||
Adrien
|
||||
Gilbert
|
||||
Keenan
|
||||
Darnell
|
||||
Adolfo
|
||||
Tristian
|
||||
Derick
|
||||
Isai
|
||||
Rylee
|
||||
Gauge
|
||||
Harold
|
||||
Kareem
|
||||
Deangelo
|
||||
Agustin
|
||||
Coleman
|
||||
Zavier
|
||||
Lamar
|
||||
Emery
|
||||
Jaydin
|
||||
Devan
|
||||
Jordyn
|
||||
Mathias
|
||||
Prince
|
||||
Seamus
|
||||
Jasiah
|
||||
Efrain
|
||||
Darryl
|
||||
Arjun
|
||||
Miguel
|
||||
Roland
|
||||
Conrad
|
||||
Kamron
|
||||
Hamza
|
||||
Santos
|
||||
Frankie
|
||||
Dominique
|
||||
Marley
|
||||
Vance
|
||||
Dax
|
||||
Jamir
|
||||
Kylan
|
||||
Todd
|
||||
Maximo
|
||||
Jabari
|
||||
Matthias
|
||||
Haiden
|
||||
Luka
|
||||
Marcelo
|
||||
Keon
|
||||
Layton
|
||||
Tyrell
|
||||
Kash
|
||||
Laney
|
||||
Isis
|
||||
Marcela
|
||||
Dave
|
||||
Amos
|
||||
Grover
|
||||
29
workflow/engine/test/fixtures/fixtures.yml
vendored
29
workflow/engine/test/fixtures/fixtures.yml
vendored
@@ -1,29 +0,0 @@
|
||||
-
|
||||
input: '/test'
|
||||
output: true
|
||||
comment: isPathAbsolute() returns true if path is absolute
|
||||
-
|
||||
input: '\\test'
|
||||
output: true
|
||||
comment: isPathAbsolute() returns true if path is absolute
|
||||
-
|
||||
input: 'C:\\test'
|
||||
output: true
|
||||
comment: isPathAbsolute() returns true if path is absolute
|
||||
-
|
||||
input: 'd:/test'
|
||||
output: true
|
||||
comment: isPathAbsolute() returns true if path is absolute
|
||||
-
|
||||
input: 'test'
|
||||
output: false
|
||||
comment: isPathAbsolute() returns false if path is relative
|
||||
-
|
||||
input: '../test'
|
||||
output: false
|
||||
comment: isPathAbsolute() returns false if path is relative
|
||||
-
|
||||
input: '..\\test'
|
||||
output: false
|
||||
comment: isPathAbsolute() returns false if path is relative
|
||||
|
||||
36
workflow/engine/test/fixtures/groupUser.yml
vendored
36
workflow/engine/test/fixtures/groupUser.yml
vendored
@@ -1,36 +0,0 @@
|
||||
create1:
|
||||
-
|
||||
Title: "Create the group user row"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
GRP_UID: "2"
|
||||
USR_UID: "2"
|
||||
input:
|
||||
Type: "integer"
|
||||
create2:
|
||||
-
|
||||
Title: "Create the group user row (whit incomplete data)"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
GRP_UID: ""
|
||||
USR_UID: "2"
|
||||
input:
|
||||
Type: "Exception"
|
||||
remove1:
|
||||
-
|
||||
Title: "Remove the group user row"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
GRP_UID: "2"
|
||||
USR_UID: "2"
|
||||
input:
|
||||
Type: "NULL"
|
||||
remove2:
|
||||
-
|
||||
Title: "Remove the group user row (not existent)"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
GRP_UID: "111111111111"
|
||||
USR_UID: "222222222222"
|
||||
input:
|
||||
Type: "Exception"
|
||||
32
workflow/engine/test/fixtures/groups.txt
vendored
32
workflow/engine/test/fixtures/groups.txt
vendored
@@ -1,32 +0,0 @@
|
||||
Marketing Users
|
||||
Operators
|
||||
Accounters
|
||||
Lawyers
|
||||
Operators
|
||||
Salespersons
|
||||
Team A
|
||||
Team B
|
||||
Team C
|
||||
Team D
|
||||
Team E
|
||||
Team F
|
||||
Team G
|
||||
Team H
|
||||
Team I
|
||||
Team J
|
||||
Team K
|
||||
Team L
|
||||
Team M
|
||||
Team N
|
||||
Team O
|
||||
Team P
|
||||
Team Q
|
||||
Team R
|
||||
Team S
|
||||
Team T
|
||||
Team U
|
||||
Team V
|
||||
Team W
|
||||
Team X
|
||||
Team Y
|
||||
Team Z
|
||||
88
workflow/engine/test/fixtures/inputDocument.yml
vendored
88
workflow/engine/test/fixtures/inputDocument.yml
vendored
@@ -1,88 +0,0 @@
|
||||
load1:
|
||||
-
|
||||
Title: "Obtain the input document data"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
INP_DOC_UID: "1"
|
||||
input:
|
||||
Type: "array"
|
||||
load2:
|
||||
-
|
||||
Title: "Obtain the input document data (not existent)"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
INP_DOC_UID: "111111111111"
|
||||
input:
|
||||
Type: "Exception"
|
||||
create1:
|
||||
-
|
||||
Title: "Create the input document data"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
INP_DOC_UID: "2"
|
||||
PRO_UID: "2"
|
||||
INP_DOC_FORM_NEEDED: "VREAL"
|
||||
INP_DOC_ORIGINAL: "ORIGINAL"
|
||||
INP_DOC_PUBLISHED: "PUBLIC"
|
||||
INP_DOC_TITLE: "INP_DOC_TITLE"
|
||||
INP_DOC_DESCRIPTION: "INP_DOC_DESCRIPTION"
|
||||
input:
|
||||
Type: "integer"
|
||||
create2:
|
||||
-
|
||||
Title: "Create the input document data (whit incomplete data)"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
INP_DOC_UID: ""
|
||||
PRO_UID: "2"
|
||||
INP_DOC_FORM_NEEDED: "VREAL"
|
||||
INP_DOC_ORIGINAL: "ORIGINAL"
|
||||
INP_DOC_PUBLISHED: "PUBLIC"
|
||||
INP_DOC_TITLE: "INP_DOC_TITLE"
|
||||
INP_DOC_DESCRIPTION: "INP_DOC_DESCRIPTION"
|
||||
input:
|
||||
Type: "Exception"
|
||||
update1:
|
||||
-
|
||||
Title: "Update the input document data"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
INP_DOC_UID: "1"
|
||||
PRO_UID: "2"
|
||||
INP_DOC_FORM_NEEDED: "VREAL"
|
||||
INP_DOC_ORIGINAL: "ORIGINAL"
|
||||
INP_DOC_PUBLISHED: "PUBLIC"
|
||||
INP_DOC_TITLE: "INP_DOC_TITLE1"
|
||||
INP_DOC_DESCRIPTION: "INP_DOC_DESCRIPTION1"
|
||||
input:
|
||||
Type: "integer"
|
||||
update2:
|
||||
-
|
||||
Title: "Update the input document data (not existent)"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
INP_DOC_UID: "111111111111"
|
||||
PRO_UID: "2"
|
||||
INP_DOC_FORM_NEEDED: "VREAL"
|
||||
INP_DOC_ORIGINAL: "ORIGINAL"
|
||||
INP_DOC_PUBLISHED: "PUBLIC"
|
||||
INP_DOC_TITLE: "INP_DOC_TITLE1"
|
||||
INP_DOC_DESCRIPTION: "INP_DOC_DESCRIPTION1"
|
||||
input:
|
||||
Type: "Exception"
|
||||
remove1:
|
||||
-
|
||||
Title: "Remove the input document data"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
INP_DOC_UID: "2"
|
||||
input:
|
||||
Type: "NULL"
|
||||
remove2:
|
||||
-
|
||||
Title: "Remove the input document data (not existent)"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
INP_DOC_UID: "111111111111"
|
||||
input:
|
||||
Type: "Exception"
|
||||
222
workflow/engine/test/fixtures/lastname.txt
vendored
222
workflow/engine/test/fixtures/lastname.txt
vendored
@@ -1,222 +0,0 @@
|
||||
Agnes
|
||||
Ahearn
|
||||
Amadon
|
||||
Anderson
|
||||
Arbouet
|
||||
Arinello
|
||||
Austin
|
||||
Balisi
|
||||
barkle
|
||||
Barrett
|
||||
Basili
|
||||
Beam
|
||||
Beccia
|
||||
Bechtel
|
||||
Bendis
|
||||
Bittner
|
||||
Bittner
|
||||
Black
|
||||
Blackshear
|
||||
Boria
|
||||
Bosworth
|
||||
Bourgeous
|
||||
Broderick
|
||||
Brown
|
||||
Brule
|
||||
Burns
|
||||
Cagley
|
||||
Champagne
|
||||
Charette
|
||||
Ching
|
||||
Ciarleglio
|
||||
Cifrino
|
||||
Cifuni
|
||||
Cleveland
|
||||
Cole
|
||||
Connelly
|
||||
Connolly
|
||||
Corleone
|
||||
Cook
|
||||
Corey
|
||||
Corey
|
||||
Cowell
|
||||
Creelman
|
||||
Cremins
|
||||
Crowley
|
||||
Daley
|
||||
Debrosse
|
||||
Debrosse-Saint-Louis
|
||||
Deleskey
|
||||
Demers
|
||||
Dempsey
|
||||
Diehl
|
||||
Dobbie
|
||||
Dockstader
|
||||
Doe
|
||||
Downey
|
||||
Dribin
|
||||
Ducharme
|
||||
Duphily
|
||||
Eckstein
|
||||
Ericson
|
||||
Evans
|
||||
Fabel
|
||||
Farrell
|
||||
Favreau
|
||||
Favreau
|
||||
Foley
|
||||
Follett
|
||||
Forrest
|
||||
Gack
|
||||
Galorath
|
||||
Garmus
|
||||
Gehly
|
||||
Gendron
|
||||
Gladney
|
||||
Glanville
|
||||
Goldsmith
|
||||
Gottesdiener
|
||||
Grealish
|
||||
Haaigis
|
||||
Hacker
|
||||
Hacker-LeCount
|
||||
Haddad
|
||||
Haigis
|
||||
Hamel
|
||||
Harrington
|
||||
Henderson
|
||||
Hennessey
|
||||
Herron
|
||||
Hessmiller
|
||||
Hill
|
||||
Hillier
|
||||
Hobbs
|
||||
Hobbs
|
||||
Hobbs
|
||||
Ierardi
|
||||
Isaacs
|
||||
Jones
|
||||
Kappelman
|
||||
Karem
|
||||
Karten
|
||||
Keith
|
||||
Kelly
|
||||
Kenny
|
||||
Killilea
|
||||
Krasner
|
||||
LaFrance
|
||||
Lawhorn
|
||||
Layman
|
||||
LeBlanc
|
||||
Legarz
|
||||
Leo
|
||||
Leonard
|
||||
Lewis
|
||||
Lokinger
|
||||
Lovering
|
||||
Lusk
|
||||
MacDonald
|
||||
Maciewicz
|
||||
Maguire
|
||||
Mahoney
|
||||
Mariani
|
||||
McCarthy
|
||||
McCauley
|
||||
McDonald
|
||||
McGarry
|
||||
McMahon
|
||||
Menard
|
||||
Minkiewicz
|
||||
Moe
|
||||
Morrison
|
||||
Motyka
|
||||
Murphy
|
||||
Nemes
|
||||
Newman
|
||||
Newman
|
||||
Nickels
|
||||
Nye
|
||||
Nyman
|
||||
OConnor
|
||||
Orr
|
||||
Palmer-Erbs
|
||||
Palmieri
|
||||
Panagiotes
|
||||
Parker
|
||||
Parks
|
||||
Parks
|
||||
Pelletier
|
||||
PelletierRutkowski
|
||||
Penn
|
||||
Peters
|
||||
Pfannkoch
|
||||
Pinchera
|
||||
Planansky
|
||||
Plasse
|
||||
Poillucci
|
||||
Pomerleau
|
||||
Potter
|
||||
Powers
|
||||
Primas
|
||||
Pritchard
|
||||
Quenga
|
||||
Rancourt
|
||||
Rearick
|
||||
Reifer
|
||||
Rice
|
||||
rogers
|
||||
Rooney
|
||||
Rosoff
|
||||
Roy
|
||||
Ruhe
|
||||
Russac
|
||||
Russell
|
||||
Ryan
|
||||
Sahely
|
||||
Sak
|
||||
Salvaggio
|
||||
Santiano
|
||||
Sassenburg
|
||||
Scanlon
|
||||
Schall
|
||||
Scopetski
|
||||
Searfos
|
||||
Sergio
|
||||
Sergio
|
||||
Shapiro
|
||||
Sharpe
|
||||
Silck
|
||||
Silveri
|
||||
Simmons
|
||||
Simons
|
||||
Skirvin-Leclair
|
||||
Smalarz
|
||||
Smith
|
||||
Smith-Burke
|
||||
Sullivan
|
||||
Swansburg
|
||||
Sweeney
|
||||
Talley
|
||||
Taylor
|
||||
Tebbetts
|
||||
Thaxton
|
||||
Tiberio
|
||||
tillman
|
||||
Tilton(Cuttino)
|
||||
Toronto
|
||||
Tull
|
||||
Vernon
|
||||
VonHalle
|
||||
Walendziewicz
|
||||
Walker
|
||||
Walsh
|
||||
Wei
|
||||
Welsh
|
||||
Wiegers
|
||||
Wilkins
|
||||
Williams
|
||||
Wright
|
||||
Wyron
|
||||
Young
|
||||
Yourdon
|
||||
Zentis
|
||||
84
workflow/engine/test/fixtures/outputDocument.yml
vendored
84
workflow/engine/test/fixtures/outputDocument.yml
vendored
@@ -1,84 +0,0 @@
|
||||
load1:
|
||||
-
|
||||
Title: "Obtain the output document data"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
OUT_DOC_UID: "1"
|
||||
Output:
|
||||
Type: "array"
|
||||
load2:
|
||||
-
|
||||
Title: "Obtain the output document data (not existent)"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
OUT_DOC_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
create1:
|
||||
-
|
||||
Title: "Create the output document data"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
OUT_DOC_UID: "2"
|
||||
PRO_UID: "2"
|
||||
OUT_DOC_TITLE: "OUT_DOC_TITLE"
|
||||
OUT_DOC_DESCRIPTION: "OUT_DOC_DESCRIPTION"
|
||||
OUT_DOC_FILENAME: "OUT_DOC_FILENAME"
|
||||
OUT_DOC_TEMPLATE: "OUT_DOC_TEMPLATE"
|
||||
Output:
|
||||
Type: "integer"
|
||||
create2:
|
||||
-
|
||||
Title: "Create the output document data (whit incomplete data)"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
OUT_DOC_UID: ""
|
||||
PRO_UID: "2"
|
||||
OUT_DOC_TITLE: "OUT_DOC_TITLE"
|
||||
OUT_DOC_DESCRIPTION: "OUT_DOC_DESCRIPTION"
|
||||
OUT_DOC_FILENAME: "OUT_DOC_FILENAME"
|
||||
OUT_DOC_TEMPLATE: "OUT_DOC_TEMPLATE"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
update1:
|
||||
-
|
||||
Title: "Update the output document data"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
OUT_DOC_UID: "1"
|
||||
PRO_UID: "2"
|
||||
OUT_DOC_TITLE: "OUT_DOC_TITLE1"
|
||||
OUT_DOC_DESCRIPTION: "OUT_DOC_DESCRIPTION1"
|
||||
OUT_DOC_FILENAME: "OUT_DOC_FILENAME1"
|
||||
OUT_DOC_TEMPLATE: "OUT_DOC_TEMPLATE1"
|
||||
Output:
|
||||
Type: "integer"
|
||||
update2:
|
||||
-
|
||||
Title: "Update the output document data (not existent)"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
OUT_DOC_UID: "111111111111"
|
||||
PRO_UID: "2"
|
||||
OUT_DOC_TITLE: "OUT_DOC_TITLE1"
|
||||
OUT_DOC_DESCRIPTION: "OUT_DOC_DESCRIPTION1"
|
||||
OUT_DOC_FILENAME: "OUT_DOC_FILENAME1"
|
||||
OUT_DOC_TEMPLATE: "OUT_DOC_TEMPLATE1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
remove1:
|
||||
-
|
||||
Title: "Remove the output document data"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
OUT_DOC_UID: "2"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
remove2:
|
||||
-
|
||||
Title: "Remove the output document data (not existent)"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
OUT_DOC_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
494
workflow/engine/test/fixtures/processMap.yml
vendored
494
workflow/engine/test/fixtures/processMap.yml
vendored
@@ -1,494 +0,0 @@
|
||||
load1:
|
||||
-
|
||||
Title: "Obtain the processmap data"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "string"
|
||||
load2:
|
||||
-
|
||||
Title: "Obtain the processmap data (not existent)"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
createProcess1:
|
||||
-
|
||||
Title: "Create a process"
|
||||
Function: "createProcessTest"
|
||||
Input:
|
||||
USR_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
updateProcess1:
|
||||
-
|
||||
Title: "Update a process"
|
||||
Function: "updateProcessTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
PRO_TITLE_X: 100
|
||||
PRO_TITLE_Y: 100
|
||||
Output:
|
||||
Type: "integer"
|
||||
updateProcess2:
|
||||
-
|
||||
Title: "Update a process (not existent)"
|
||||
Function: "updateProcessTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
PRO_TITLE_X: 100
|
||||
PRO_TITLE_Y: 100
|
||||
Output:
|
||||
Type: "Exception"
|
||||
editProcess1:
|
||||
-
|
||||
Title: "Edit the process info"
|
||||
Function: "editProcessTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
editProcess2:
|
||||
-
|
||||
Title: "Edit the process info (not existent)"
|
||||
Function: "editProcessTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
saveTitlePosition1:
|
||||
-
|
||||
Title: "Save the title position"
|
||||
Function: "saveTitlePositionTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
PRO_X: 100
|
||||
PRO_Y: 100
|
||||
Output:
|
||||
Type: "boolean"
|
||||
saveTitlePosition2:
|
||||
-
|
||||
Title: "Save the title position (not existent)"
|
||||
Function: "saveTitlePositionTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
PRO_X: 100
|
||||
PRO_Y: 100
|
||||
Output:
|
||||
Type: "Exception"
|
||||
steps1:
|
||||
-
|
||||
Title: "Show the task steps"
|
||||
Function: "stepsTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
steps2:
|
||||
-
|
||||
Title: "Show the task steps (not existent)"
|
||||
Function: "stepsTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
users1:
|
||||
-
|
||||
Title: "Show the task users"
|
||||
Function: "usersTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
users2:
|
||||
-
|
||||
Title: "Show the task users (not existent)"
|
||||
Function: "usersTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
stepsConditions1:
|
||||
-
|
||||
Title: "Show the step conditions of the task"
|
||||
Function: "stepsConditionsTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
stepsConditions2:
|
||||
-
|
||||
Title: "Show the step conditions of the task (not existent)"
|
||||
Function: "stepsConditionsTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
stepsTriggers1:
|
||||
-
|
||||
Title: "Show the step triggers of the task"
|
||||
Function: "stepsTriggersTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
stepsTriggers2:
|
||||
-
|
||||
Title: "Show the step triggers of the task (not existent)"
|
||||
Function: "stepsTriggersTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
addTask1:
|
||||
-
|
||||
Title: "Add a task to process"
|
||||
Function: "addTaskTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
TAS_X: 100
|
||||
TAS_Y: 100
|
||||
Output:
|
||||
Type: "boolean"
|
||||
addTask2:
|
||||
-
|
||||
Title: "Add a task to process (not existent)"
|
||||
Function: "addTaskTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
TAS_X: 100
|
||||
TAS_Y: 100
|
||||
Output:
|
||||
Type: "Exception"
|
||||
editTaskProperties1:
|
||||
-
|
||||
Title: "Edit the task properties"
|
||||
Function: "editTaskPropertiesTest"
|
||||
Input:
|
||||
TAS_UID: "1"
|
||||
iForm: 1
|
||||
iIndex: 0
|
||||
Output:
|
||||
Type: "boolean"
|
||||
editTaskProperties2:
|
||||
-
|
||||
Title: "Edit the task properties (not existent)"
|
||||
Function: "editTaskPropertiesTest"
|
||||
Input:
|
||||
TAS_UID: "111111111111"
|
||||
iForm: 1
|
||||
iIndex: 0
|
||||
Output:
|
||||
Type: "Exception"
|
||||
saveTaskPosition1:
|
||||
-
|
||||
Title: "Save the task position"
|
||||
Function: "saveTaskPositionTest"
|
||||
Input:
|
||||
TAS_UID: "1"
|
||||
TAS_X: 100
|
||||
TAS_Y: 100
|
||||
Output:
|
||||
Type: "integer"
|
||||
saveTaskPosition2:
|
||||
-
|
||||
Title: "Save the task position (not existent)"
|
||||
Function: "saveTaskPositionTest"
|
||||
Input:
|
||||
TAS_UID: "111111111111"
|
||||
TAS_X: 100
|
||||
TAS_Y: 100
|
||||
Output:
|
||||
Type: "Exception"
|
||||
deleteTask1:
|
||||
-
|
||||
Title: "Delete a task"
|
||||
Function: "deleteTaskTest"
|
||||
Input:
|
||||
TAS_UID: "1"
|
||||
TAS_X: 100
|
||||
TAS_Y: 100
|
||||
Output:
|
||||
Type: "boolean"
|
||||
deleteTask2:
|
||||
-
|
||||
Title: "Delete a task (not existent)"
|
||||
Function: "deleteTaskTest"
|
||||
Input:
|
||||
TAS_UID: "111111111111"
|
||||
TAS_X: 100
|
||||
TAS_Y: 100
|
||||
Output:
|
||||
Type: "Exception"
|
||||
addGuide1:
|
||||
-
|
||||
Title: "Add a new guide"
|
||||
Function: "addGuideTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
iPosition: 100
|
||||
sDirection: "vertical"
|
||||
Output:
|
||||
Type: "string"
|
||||
addGuide2:
|
||||
-
|
||||
Title: "Add a new guide (not existent)"
|
||||
Function: "addGuideTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
iPosition: 100
|
||||
sDirection: "vertical"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
saveGuidePosition1:
|
||||
-
|
||||
Title: "Save de guide position"
|
||||
Function: "saveGuidePositionTest"
|
||||
Input:
|
||||
SWI_UID: "1"
|
||||
iPosition: 100
|
||||
sDirection: "vertical"
|
||||
Output:
|
||||
Type: "integer"
|
||||
saveGuidePosition2:
|
||||
-
|
||||
Title: "Save de guide position (not existent)"
|
||||
Function: "saveGuidePositionTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
iPosition: 100
|
||||
sDirection: "vertical"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
deleteGuide1:
|
||||
-
|
||||
Title: "Delete a guide"
|
||||
Function: "deleteGuideTest"
|
||||
Input:
|
||||
SWI_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
deleteGuide2:
|
||||
-
|
||||
Title: "Delete a guide (not existent)"
|
||||
Function: "deleteGuideTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
deleteGuides1:
|
||||
-
|
||||
Title: "Delete all guides"
|
||||
Function: "deleteGuidesTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
deleteGuides2:
|
||||
-
|
||||
Title: "Delete all guides (not existent)"
|
||||
Function: "deleteGuidesTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
updateText1:
|
||||
-
|
||||
Title: "Update a text"
|
||||
Function: "updateTextTest"
|
||||
Input:
|
||||
SWI_UID: "1"
|
||||
SWI_TEXT: "text1"
|
||||
Output:
|
||||
Type: "integer"
|
||||
updateText2:
|
||||
-
|
||||
Title: "Update a text (not existent)"
|
||||
Function: "updateTextTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
SWI_TEXT: "text1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
saveTextPosition1:
|
||||
-
|
||||
Title: "Update a text position"
|
||||
Function: "saveTextPositionTest"
|
||||
Input:
|
||||
SWI_UID: "1"
|
||||
SWI_X: 100
|
||||
SWI_Y: 100
|
||||
Output:
|
||||
Type: "integer"
|
||||
saveTextPosition2:
|
||||
-
|
||||
Title: "Update a text position (not existent)"
|
||||
Function: "saveTextPositionTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
SWI_X: 100
|
||||
SWI_Y: 100
|
||||
Output:
|
||||
Type: "Exception"
|
||||
deleteText1:
|
||||
-
|
||||
Title: "Delete a text"
|
||||
Function: "deleteTextTest"
|
||||
Input:
|
||||
SWI_UID: "2"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
deleteText2:
|
||||
-
|
||||
Title: "Delete a text (not existent)"
|
||||
Function: "deleteTextTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
dynaformsList1:
|
||||
-
|
||||
Title: "Show the dynaforms list"
|
||||
Function: "dynaformsListTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
dynaformsList2:
|
||||
-
|
||||
Title: "Show the dynaforms list (not existent)"
|
||||
Function: "dynaformsListTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
outputdocsList1:
|
||||
-
|
||||
Title: "Show the output documents list"
|
||||
Function: "outputdocsListTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
outputdocsList2:
|
||||
-
|
||||
Title: "Show the output documents list (not existent)"
|
||||
Function: "outputdocsListTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
inputdocsList1:
|
||||
-
|
||||
Title: "Show the input documents list"
|
||||
Function: "inputdocsListTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
inputdocsList2:
|
||||
-
|
||||
Title: "Show the input documents list (not existent)"
|
||||
Function: "inputdocsListTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
triggersList1:
|
||||
-
|
||||
Title: "Show the triggers list"
|
||||
Function: "triggersListTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
triggersList2:
|
||||
-
|
||||
Title: "Show the triggers list (not existent)"
|
||||
Function: "triggersListTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
messagesList1:
|
||||
-
|
||||
Title: "Show the messages list"
|
||||
Function: "messagesListTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
messagesList2:
|
||||
-
|
||||
Title: "Show the messages list (not existent)"
|
||||
Function: "messagesListTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
currentPattern1:
|
||||
-
|
||||
Title: "Show the current pattern"
|
||||
Function: "currentPatternTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
currentPattern2:
|
||||
-
|
||||
Title: "Show the current pattern (not existent)"
|
||||
Function: "currentPatternTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
newPattern1:
|
||||
-
|
||||
Title: "New pattern"
|
||||
Function: "newPatternTest"
|
||||
Input:
|
||||
PRO_UID: "1"
|
||||
TAS_UID: "1"
|
||||
ROU_NEXT_TASK: "2"
|
||||
ROU_TYPE: "SEQUENTIAL"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
newPattern2:
|
||||
-
|
||||
Title: "New pattern (not existent)"
|
||||
Function: "newPatternTest"
|
||||
Input:
|
||||
PRO_UID: "111111111111"
|
||||
TAS_UID: "1"
|
||||
ROU_NEXT_TASK: "2"
|
||||
ROU_TYPE: "SEQUENTIAL"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
deleteDerivation1:
|
||||
-
|
||||
Title: "Delete a derivation rule"
|
||||
Function: "deleteDerivationTest"
|
||||
Input:
|
||||
TAS_UID: "1"
|
||||
Output:
|
||||
Type: "boolean"
|
||||
deleteDerivation2:
|
||||
-
|
||||
Title: "Delete a derivation rule (not existent)"
|
||||
Function: "deleteDerivationTest"
|
||||
Input:
|
||||
TAS_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
112
workflow/engine/test/fixtures/route.yml
vendored
112
workflow/engine/test/fixtures/route.yml
vendored
@@ -1,112 +0,0 @@
|
||||
load1:
|
||||
-
|
||||
Title: "Obtain the route data"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
ROU_UID: "1"
|
||||
Output:
|
||||
Type: "array"
|
||||
load2:
|
||||
-
|
||||
Title: "Obtain the route data (not existent)"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
ROU_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
create1:
|
||||
-
|
||||
Title: "Create the route data"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
ROU_UID: "2"
|
||||
ROU_PARENT: ""
|
||||
PRO_UID: "2"
|
||||
TAS_UID: "2"
|
||||
ROU_NEXT_TAK: "2"
|
||||
ROU_CASE: "0"
|
||||
ROU_TYPE: "SEQUENTIAL"
|
||||
ROU_CONDITION: ""
|
||||
ROU_TO_LAST_USER: "FALSE"
|
||||
ROU_OPTIONAL: "FALSE"
|
||||
ROU_SEND_EMAIL: "TRUE"
|
||||
ROU_SOURCEANCHOR: "1"
|
||||
ROU_TARGETANCHOR: "0"
|
||||
Output:
|
||||
Type: "integer"
|
||||
create2:
|
||||
-
|
||||
Title: "Create the route data (whit incomplete data)"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
ROU_UID: ""
|
||||
ROU_PARENT: ""
|
||||
PRO_UID: "2"
|
||||
TAS_UID: "2"
|
||||
ROU_NEXT_TAK: "2"
|
||||
ROU_CASE: "0"
|
||||
ROU_TYPE: "SEQUENTIAL"
|
||||
ROU_CONDITION: ""
|
||||
ROU_TO_LAST_USER: "FALSE"
|
||||
ROU_OPTIONAL: "FALSE"
|
||||
ROU_SEND_EMAIL: "TRUE"
|
||||
ROU_SOURCEANCHOR: "1"
|
||||
ROU_TARGETANCHOR: "0"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
update1:
|
||||
-
|
||||
Title: "Update the route data"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
ROU_UID: "1"
|
||||
ROU_PARENT: ""
|
||||
PRO_UID: "2"
|
||||
TAS_UID: "2"
|
||||
ROU_NEXT_TAK: "2"
|
||||
ROU_CASE: "0"
|
||||
ROU_TYPE: "SEQUENTIAL"
|
||||
ROU_CONDITION: ""
|
||||
ROU_TO_LAST_USER: "FALSE"
|
||||
ROU_OPTIONAL: "FALSE"
|
||||
ROU_SEND_EMAIL: "TRUE"
|
||||
ROU_SOURCEANCHOR: "1"
|
||||
ROU_TARGETANCHOR: "0"
|
||||
Output:
|
||||
Type: "integer"
|
||||
update2:
|
||||
-
|
||||
Title: "Update the route data (not existent)"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
ROU_UID: "111111111111"
|
||||
ROU_PARENT: ""
|
||||
PRO_UID: "2"
|
||||
TAS_UID: "2"
|
||||
ROU_NEXT_TAK: "2"
|
||||
ROU_CASE: "0"
|
||||
ROU_TYPE: "SEQUENTIAL"
|
||||
ROU_CONDITION: ""
|
||||
ROU_TO_LAST_USER: "FALSE"
|
||||
ROU_OPTIONAL: "FALSE"
|
||||
ROU_SEND_EMAIL: "TRUE"
|
||||
ROU_SOURCEANCHOR: "1"
|
||||
ROU_TARGETANCHOR: "0"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
remove1:
|
||||
-
|
||||
Title: "Remove the route data"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
ROU_UID: "2"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
remove2:
|
||||
-
|
||||
Title: "Remove the route data (not existent)"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
ROU_UID: "111111111111"
|
||||
Output:
|
||||
Type: "Exception"
|
||||
35
workflow/engine/test/fixtures/step.yml
vendored
35
workflow/engine/test/fixtures/step.yml
vendored
@@ -1,35 +0,0 @@
|
||||
CreateTestSteps:
|
||||
-
|
||||
Title:"Creating new Steps"
|
||||
Function:"CreateStep"
|
||||
Input:
|
||||
PRO_UID[]:"guid.pm"
|
||||
TAS_UID[]:"guid.pm"
|
||||
Output:
|
||||
Value: 1
|
||||
StepUnitTest:
|
||||
-
|
||||
Title:"Updating Steps"
|
||||
Function:"UpdateStep"
|
||||
Input:
|
||||
STEP_UID[]:"*.CREATED"
|
||||
PRO_UID[]:"guid.pm"
|
||||
TAS_UID[]:"guid.pm"
|
||||
STEP_OBJ_UID[]:"stepUidObj.pm"
|
||||
STEP_POSITION[]:"rand.number"
|
||||
Output:
|
||||
Value: 1
|
||||
-
|
||||
Title:"Loading Steps"
|
||||
Function:"LoadStep"
|
||||
Input:
|
||||
STEP_UID[]:"*.CREATED"
|
||||
Output:
|
||||
Type: "array"
|
||||
-
|
||||
Title:"Removing Steps"
|
||||
Function:"RemoveStep"
|
||||
Input:
|
||||
STEP_UID[]:"*.CREATED"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
43
workflow/engine/test/fixtures/stepTrigger.yml
vendored
43
workflow/engine/test/fixtures/stepTrigger.yml
vendored
@@ -1,43 +0,0 @@
|
||||
CreateTestSteps:
|
||||
-
|
||||
Title:"Creating new Steps"
|
||||
Function:"CreateStep"
|
||||
Input:
|
||||
STEP_UID[]:"guid.pm"
|
||||
TAS_UID[]:"guid.pm"
|
||||
TRI_UID[]:"guid.pm"
|
||||
ST_TYPE:"Step Type"
|
||||
Output:
|
||||
Value: 1
|
||||
StepUnitTest:
|
||||
-
|
||||
Title:"Updating Steps"
|
||||
Function:"UpdateStep"
|
||||
Input:
|
||||
STEP_UID[]:"CREATED"
|
||||
TAS_UID[]:"CREATED_TAS"
|
||||
TRI_UID[]:"CREATED_TRI"
|
||||
ST_TYPE[]:"CREATED_TYPE"
|
||||
ST_CONDITION[]:"*.text.es"
|
||||
Output:
|
||||
Value: 1
|
||||
-
|
||||
Title:"Loading Steps"
|
||||
Function:"LoadStep"
|
||||
Input:
|
||||
STEP_UID[]:"CREATED"
|
||||
TAS_UID[]:"CREATED_TAS"
|
||||
TRI_UID[]:"CREATED_TRI"
|
||||
ST_TYPE[]:"CREATED_TYPE"
|
||||
Output:
|
||||
Type: "array"
|
||||
-
|
||||
Title:"Removing Steps"
|
||||
Function:"RemoveStep"
|
||||
Input:
|
||||
STEP_UID[]:"CREATED"
|
||||
TAS_UID[]:"CREATED_TAS"
|
||||
TRI_UID[]:"CREATED_TRI"
|
||||
ST_TYPE[]:"CREATED_TYPE"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
@@ -1,84 +0,0 @@
|
||||
load1:
|
||||
-
|
||||
Title: "Obtain the swimlane element data"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
SWI_UID: "1"
|
||||
input:
|
||||
Type: "array"
|
||||
load2:
|
||||
-
|
||||
Title: "Obtain the swimlane element data (not existent)"
|
||||
Function: "loadTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
input:
|
||||
Type: "Exception"
|
||||
create1:
|
||||
-
|
||||
Title: "Create the swimlane element data"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
SWI_UID: "2"
|
||||
PRO_UID: "2"
|
||||
SWI_TYPE: "LINE"
|
||||
SWI_X: "100"
|
||||
SWI_Y: "0"
|
||||
SWI_TEXT: "SWI_TEXT"
|
||||
input:
|
||||
Type: "integer"
|
||||
create2:
|
||||
-
|
||||
Title: "Create the swimlane element data (whit incomplete data)"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
SWI_UID: ""
|
||||
PRO_UID: "2"
|
||||
SWI_TYPE: "LINE"
|
||||
SWI_X: "100"
|
||||
SWI_Y: "0"
|
||||
SWI_TEXT: "SWI_TEXT"
|
||||
input:
|
||||
Type: "Exception"
|
||||
update1:
|
||||
-
|
||||
Title: "Update the swimlane element data"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
SWI_UID: "1"
|
||||
PRO_UID: "2"
|
||||
SWI_TYPE: "LINE"
|
||||
SWI_X: "100"
|
||||
SWI_Y: "0"
|
||||
SWI_TEXT: "SWI_TEXT1"
|
||||
input:
|
||||
Type: "integer"
|
||||
update2:
|
||||
-
|
||||
Title: "Update the swimlane element data (not existent)"
|
||||
Function: "updateTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
PRO_UID: "2"
|
||||
SWI_TYPE: "LINE"
|
||||
SWI_X: "100"
|
||||
SWI_Y: "0"
|
||||
SWI_TEXT: "SWI_TEXT1"
|
||||
input:
|
||||
Type: "Exception"
|
||||
remove1:
|
||||
-
|
||||
Title: "Remove the swimlane element data"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
SWI_UID: "2"
|
||||
input:
|
||||
Type: "NULL"
|
||||
remove2:
|
||||
-
|
||||
Title: "Remove the swimlane element data (not existent)"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
SWI_UID: "111111111111"
|
||||
input:
|
||||
Type: "Exception"
|
||||
32
workflow/engine/test/fixtures/task.yml
vendored
32
workflow/engine/test/fixtures/task.yml
vendored
@@ -1,32 +0,0 @@
|
||||
CreateTestTasks:
|
||||
-
|
||||
Title:"Creating new tasks"
|
||||
Function:"CreateTask"
|
||||
Input:
|
||||
PRO_UID[]:"guid.pm"
|
||||
Output:
|
||||
Value: 1
|
||||
TaskUnitTest:
|
||||
-
|
||||
Title:"Updating tasks"
|
||||
Function:"UpdateTask"
|
||||
Input:
|
||||
TAS_UID[]: "*.CREATED"
|
||||
TAS_DESCRIPTION[]: "text.es"
|
||||
TAS_TITLE[]: "*.html.es"
|
||||
Output:
|
||||
Value: 1
|
||||
-
|
||||
Title:"Loading tasks"
|
||||
Function:"LoadTask"
|
||||
Input:
|
||||
TAS_UID[]: "*.CREATED"
|
||||
Output:
|
||||
Type: "array"
|
||||
-
|
||||
Title:"Removing tasks"
|
||||
Function:"RemoveTask"
|
||||
Input:
|
||||
TAS_UID[]: "*.CREATED"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
44
workflow/engine/test/fixtures/taskUser.yml
vendored
44
workflow/engine/test/fixtures/taskUser.yml
vendored
@@ -1,44 +0,0 @@
|
||||
create1:
|
||||
-
|
||||
Title: "Create the group user row"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
TAS_UID: "2"
|
||||
USR_UID: "2"
|
||||
TU_TYPE: "2"
|
||||
TU_RELATION: "2"
|
||||
input:
|
||||
Type: "integer"
|
||||
create2:
|
||||
-
|
||||
Title: "Create the group user row (whit incomplete data)"
|
||||
Function: "createTest"
|
||||
Input:
|
||||
TAS_UID: ""
|
||||
USR_UID: "2"
|
||||
TU_TYPE: "2"
|
||||
TU_RELATION: "2"
|
||||
input:
|
||||
Type: "Exception"
|
||||
remove1:
|
||||
-
|
||||
Title: "Remove the group user row"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
TAS_UID: "2"
|
||||
USR_UID: "2"
|
||||
TU_TYPE: "2"
|
||||
TU_RELATION: "2"
|
||||
input:
|
||||
Type: "NULL"
|
||||
remove2:
|
||||
-
|
||||
Title: "Remove the group user row (not existent)"
|
||||
Function: "removeTest"
|
||||
Input:
|
||||
TAS_UID: "111111111111"
|
||||
USR_UID: "2"
|
||||
TU_TYPE: "2"
|
||||
TU_RELATION: "2"
|
||||
input:
|
||||
Type: "Exception"
|
||||
32
workflow/engine/test/fixtures/trigger.yml
vendored
32
workflow/engine/test/fixtures/trigger.yml
vendored
@@ -1,32 +0,0 @@
|
||||
CreateTestTriggers:
|
||||
-
|
||||
Title:"Creating new Triggers"
|
||||
Function:"CreateTrigger"
|
||||
Input:
|
||||
PRO_UID[]:"guid.pm"
|
||||
Output:
|
||||
Value: 1
|
||||
TriggerUnitTest:
|
||||
-
|
||||
Title:"Updating Triggers"
|
||||
Function:"UpdateTrigger"
|
||||
Input:
|
||||
TRI_UID[]:"*.CREATED"
|
||||
TRI_TITLE[]:"first.name.es"
|
||||
TRI_DESCRIPTION[]:"*.text.es"
|
||||
Output:
|
||||
Value: 1
|
||||
-
|
||||
Title:"Loading Triggers"
|
||||
Function:"LoadTrigger"
|
||||
Input:
|
||||
TRI_UID[]:"*.CREATED"
|
||||
Output:
|
||||
Type: "array"
|
||||
-
|
||||
Title:"Removing Triggers"
|
||||
Function:"RemoveTrigger"
|
||||
Input:
|
||||
TRI_UID[]:"*.CREATED"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
34
workflow/engine/test/fixtures/user.yml
vendored
34
workflow/engine/test/fixtures/user.yml
vendored
@@ -1,34 +0,0 @@
|
||||
CreateTestUsers:
|
||||
-
|
||||
Title:"Creating new Users"
|
||||
Function:"CreateUser"
|
||||
Input:
|
||||
USR_UID[]:"guid.pm"
|
||||
Output:
|
||||
Value: 1
|
||||
UserUnitTest:
|
||||
-
|
||||
Title:"Updating Users"
|
||||
Function:"UpdateUser"
|
||||
Input:
|
||||
USR_UID[]: "*.CREATED"
|
||||
USR_EMAIL[]: "*.email.es"
|
||||
USR_USRNAME[]: "first.name.es"
|
||||
USR_FIRSTNAME[]: "first.name.es"
|
||||
USR_LASTNAME[]: "last.name.es"
|
||||
Output:
|
||||
Value: 1
|
||||
-
|
||||
Title:"Loading Users"
|
||||
Function:"LoadUser"
|
||||
Input:
|
||||
USR_UID[]: "*.CREATED"
|
||||
Output:
|
||||
Type: "array"
|
||||
-
|
||||
Title:"Removing Users"
|
||||
Function:"RemoveUser"
|
||||
Input:
|
||||
USR_UID[]: "*.CREATED"
|
||||
Output:
|
||||
Type: "NULL"
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classDBConnectionTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
global $G_ENVIRONMENTS;
|
||||
$counter =1;
|
||||
$testItems = 0;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}else
|
||||
include ( $dbfile );
|
||||
}else
|
||||
exit (201);
|
||||
require_once( PATH_GULLIVER . 'class.dbconnection.php');
|
||||
$obj = new DBConnection();
|
||||
$method = array ( );
|
||||
$methods = get_class_methods('DBConnection');
|
||||
|
||||
$t = new lime_test( 20 , new lime_output_color());
|
||||
$t->diag('class DBConnection' );
|
||||
|
||||
/* Listing Method */
|
||||
$t->is( count( $methods ) , 8, "class DBConnection " . 8 . " methods." );
|
||||
$t->todo ( 'Listing Method' );
|
||||
$t->is( $methods[0] , 'DBConnection', $counter++.' DBConnection');
|
||||
$t->is( $methods[1] , 'Reset' , $counter++.' Reset');
|
||||
$t->is( $methods[2] , 'Free' , $counter++.' Free');
|
||||
$t->is( $methods[3] , 'Close' , $counter++.' Close');
|
||||
$t->is( $methods[4] , 'logError' , $counter++.' logError');
|
||||
$t->is( $methods[5] , 'traceError' , $counter++.' traceError');
|
||||
$t->is( $methods[6] , 'printArgs' , $counter++.' printArgs');
|
||||
$t->is( $methods[7] , 'GetLastID' , $counter++.' GetLastID');
|
||||
|
||||
/* checking methods */
|
||||
$t->todo( 'checking methods' );
|
||||
$t->can_ok( $obj, 'DBConnection', 'DBConnection()');
|
||||
$t->can_ok( $obj, 'Reset' , 'Reset()');
|
||||
$t->can_ok( $obj, 'Free' , 'Free()');
|
||||
$t->can_ok( $obj, 'Close' , 'Close()');
|
||||
$t->can_ok( $obj, 'logError' , 'logError()');
|
||||
$t->can_ok( $obj, 'traceError' , 'traceError()');
|
||||
$t->can_ok( $obj, 'printArgs' , 'printArgs()');
|
||||
$t->can_ok( $obj, 'GetLastID' , 'GetLastID()');
|
||||
$t->todo ( 'Review, specific examples.');
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classDBRecordsetTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
|
||||
require_once( PATH_GULLIVER . 'class.dbconnection.php');
|
||||
require_once( PATH_GULLIVER . 'class.dbsession.php');
|
||||
require_once( PATH_GULLIVER . 'class.dbrecordset.php');
|
||||
|
||||
$dbc = new DBConnection();
|
||||
$ses = new DBSession( $dbc);
|
||||
$dset = $ses->Execute ( "SELECT * from APPLICATION" );
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$methods = get_class_methods('DBRecordSet');
|
||||
$t = new lime_test( 8, new lime_output_color());
|
||||
|
||||
$t->diag('class DBRecordset' );
|
||||
$t->is( count($methods) , 6, "class G " . count($methods) . " methods." );
|
||||
$t->isa_ok( $dset , 'DBRecordSet' , 'class DBRecordset created');
|
||||
$t->can_ok( $dset , 'SetTo' , 'SetTo()' );
|
||||
$t->can_ok( $dset , 'Free' , 'Free()' );
|
||||
$t->can_ok( $dset , 'Count' , 'Count()' );
|
||||
$t->can_ok( $dset , 'Read' , 'Read()' );
|
||||
$t->can_ok( $dset , 'ReadAbsolute', 'ReadAbsolute()');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classDBSessionTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
|
||||
require_once( PATH_GULLIVER . 'class.dbconnection.php');
|
||||
require_once( PATH_GULLIVER . 'class.dbsession.php');
|
||||
require_once( PATH_GULLIVER . 'class.dbrecordset.php');
|
||||
$counter =1;
|
||||
$dbc = new DBConnection();
|
||||
$ses = new DBSession( $dbc);
|
||||
$dset = $ses->Execute ( "SELECT * from APPLICATION" );
|
||||
$method = array( );
|
||||
$testItems = 0;
|
||||
$methods = get_class_methods('DBSession');
|
||||
$t = new lime_test(8, new lime_output_color());
|
||||
|
||||
$t->diag('class DBSession' );
|
||||
$t->is( count($methods) , 5, "class classDBSession " . 5 . " methods." );
|
||||
$t->isa_ok( $ses , 'DBSession', 'class DBSession created');
|
||||
|
||||
$t->can_ok( $ses, 'DBSession', $counter++.' DBSession()');
|
||||
$t->can_ok( $ses, 'setTo', $counter++.' Free()');
|
||||
$t->can_ok( $ses, 'UseDB', $counter++.' UseDB()');
|
||||
$t->can_ok( $ses, 'Execute', $counter++.' Execute()');
|
||||
$t->can_ok( $ses, 'Free', $counter++.' Free()');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classDBTableTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}else
|
||||
include ( $dbfile );
|
||||
}else
|
||||
exit (201);
|
||||
|
||||
require_once( PATH_GULLIVER . 'class.dbconnection.php');
|
||||
require_once( PATH_GULLIVER . 'class.dbsession.php');
|
||||
require_once( PATH_GULLIVER . 'class.dbtable.php');
|
||||
|
||||
$dbc = new DBConnection();
|
||||
$ses = new DBSession( $dbc);
|
||||
$obj = new DBTable ( $dbc, "APPLICATION" , array ( 'APP_UID' ) );
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$methods = get_class_methods('DBTable');
|
||||
$t = new lime_test(13, new lime_output_color());
|
||||
|
||||
$t->diag('class DBTable' );
|
||||
$t->is( count($methods) , 11, "class DBTable " . 11 . " methods." );
|
||||
$t->isa_ok( $obj, 'DBTable' , 'class DBTable created');
|
||||
$t->can_ok( $obj, 'SetTo' , 'SetTo()');
|
||||
$t->can_ok( $obj, 'loadEmpty' , 'loadEmpty()');
|
||||
$t->can_ok( $obj, 'loadWhere' , 'loadWhere()');
|
||||
$t->can_ok( $obj, 'load' , 'load()');
|
||||
$t->can_ok( $obj, 'nextvalPGSql', 'nextvalPGSql()');
|
||||
$t->can_ok( $obj, 'insert' , 'insert()');
|
||||
$t->can_ok( $obj, 'update' , 'update()');
|
||||
$t->can_ok( $obj, 'save' , 'save()');
|
||||
$t->can_ok( $obj, 'delete' , 'delete()');
|
||||
$t->can_ok( $obj, 'next' , 'next()');
|
||||
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classDatabase_baseTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'database_base');
|
||||
$counter=1;
|
||||
$t = new lime_test( 12, new lime_output_color());
|
||||
$obj = new database_base();
|
||||
$methods = get_class_methods('database_base');
|
||||
|
||||
$t->diag('class database_base' );
|
||||
|
||||
/* Listing Method */
|
||||
|
||||
$t->isa_ok( $obj , 'database_base', 'class database_base created');
|
||||
$t->todo ( 'Listing Method' );
|
||||
$t->is( count ( $methods ) , 8, "class database_base " . count ( $methods ) . " methods." );
|
||||
/* checking methods */
|
||||
|
||||
$t->can_ok( $obj, '__construct' , $counter++.' __construct()');
|
||||
$t->can_ok( $obj, 'generateDropTableSQL' , $counter++.' generateDropTableSQL()');
|
||||
$t->can_ok( $obj, 'generateCreateTableSQL' , $counter++.' generateCreateTableSQL()');
|
||||
$t->can_ok( $obj, 'generateDropColumnSQL' , $counter++.' generateDropColumnSQL()');
|
||||
$t->can_ok( $obj, 'generateAddColumnSQL' , $counter++.' generateAddColumnSQL()');
|
||||
$t->can_ok( $obj, 'generateChangeColumnSQL', $counter++.' generateChangeColumnSQL()');
|
||||
$t->can_ok( $obj, 'executeQuery' , $counter++.' executeQuery()');
|
||||
$t->can_ok( $obj, 'close' , $counter++.' close()');
|
||||
|
||||
$t->todo ( 'Review, specific examples.');
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classDatabase_mysqlTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'database_mysql');
|
||||
$t = new lime_test( 24, new lime_output_color());
|
||||
$obj = new database_base();
|
||||
$method = array ();
|
||||
$testItems = 0;
|
||||
$methods = get_class_methods('database');
|
||||
$t->diag('class database' );
|
||||
$t->is( count($methods) , 21, "class database " . count($methods) . " methods." );
|
||||
$t->is( $methods[0] , '__construct', '__construct');
|
||||
$t->is( $methods[1] , 'generateCreateTableSQL' , 'generateCreateTableSQL');
|
||||
$t->is( $methods[2] , 'generateDropTableSQL' , 'generateDropTableSQL');
|
||||
$t->is( $methods[3] , 'generateDropColumnSQL' , 'generateDropColumnSQL');
|
||||
$t->is( $methods[4] , 'generateAddColumnSQL' , 'generateAddColumnSQL');
|
||||
$t->is( $methods[5] , 'generateChangeColumnSQL' , 'generateChangeColumnSQL');
|
||||
$t->is( $methods[6] , 'generateGetPrimaryKeysSQL' , 'generateGetPrimaryKeysSQL');
|
||||
$t->is( $methods[7] , 'generateDropPrimaryKeysSQL', 'generateDropPrimaryKeysSQL');
|
||||
$t->is( $methods[8] , 'generateAddPrimaryKeysSQL' , 'generateAddPrimaryKeysSQL');
|
||||
$t->is( $methods[9] , 'generateDropKeySQL' , 'generateDropKeySQL');
|
||||
$t->is( $methods[10] , 'generateAddKeysSQL' , 'generateAddKeysSQL');
|
||||
$t->is( $methods[11] , 'generateShowTablesSQL' , 'generateShowTablesSQL');
|
||||
$t->is( $methods[12] , 'generateShowTablesLikeSQL' , 'generateShowTablesLikeSQL');
|
||||
$t->is( $methods[13] , 'generateDescTableSQL' , 'generateDescTableSQL');
|
||||
$t->is( $methods[14] , 'generateTableIndexSQL' , 'generateTableIndexSQL');
|
||||
$t->is( $methods[15] , 'isConnected' , 'isConnected');
|
||||
$t->is( $methods[16] , 'logQuery' , 'logQuery');
|
||||
$t->is( $methods[17] , 'executeQuery' , 'executeQuery');
|
||||
$t->is( $methods[18] , 'countResults' , 'countResults');
|
||||
$t->is( $methods[19] , 'getRegistry' , 'getRegistry');
|
||||
$t->is( $methods[20] , 'close' , 'close');
|
||||
$t->isa_ok( $obj , 'database_base', 'class database_base created');
|
||||
$t->todo( 'Examples');
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'dynaformhandler');
|
||||
|
||||
$t = new lime_test( 20, new lime_output_color());
|
||||
$obj = "dynaFormHandler";
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$class_methods = get_class_methods('dynaFormHandler');
|
||||
foreach ($class_methods as $method_name) {
|
||||
$methods[ $testItems ] = $method_name;
|
||||
$testItems++;
|
||||
}
|
||||
|
||||
$t->diag('class dynaFormHandler' );
|
||||
$t->is( $testItems , 18, "class database " . $testItems . " methods." );
|
||||
$t->is( $methods[0] , '__construct' , '__construct');
|
||||
$t->is( $methods[1] , '__cloneEmpty' , '__cloneEmpty');
|
||||
$t->is( $methods[2] , 'toString' , 'toString');
|
||||
$t->is( $methods[3] , 'getNode' , 'getNode');
|
||||
$t->is( $methods[4] , 'setNode' , 'setNode');
|
||||
$t->is( $methods[5] , 'add' , 'add');
|
||||
$t->is( $methods[6] , 'replace' , 'replace');
|
||||
$t->is( $methods[7] , 'save' , 'save');
|
||||
$t->is( $methods[8] , 'fixXmlFile' , 'fixXmlFile');
|
||||
$t->is( $methods[9] , 'setHeaderAttribute' , 'setHeaderAttribute');
|
||||
$t->is( $methods[10] , 'modifyHeaderAttribute' , 'modifyHeaderAttribute');
|
||||
$t->is( $methods[11] , 'updateAttribute' , 'updateAttribute');
|
||||
$t->is( $methods[12] , 'remove' , 'remove');
|
||||
$t->is( $methods[13] , 'nodeExists' , 'nodeExists');
|
||||
$t->is( $methods[14] , 'moveUp' , 'moveUp');
|
||||
$t->is( $methods[15] , 'moveDown' , 'moveDown');
|
||||
$t->is( $methods[16] , 'getFields' , 'getFields');
|
||||
$t->is( $methods[17] , 'getFieldNames' , 'getFieldNames');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classErrorTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
|
||||
require_once( PATH_GULLIVER . 'class.dbconnection.php');
|
||||
require_once( PATH_GULLIVER . 'class.error.php');
|
||||
|
||||
$obj = new G_Error();
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$class_methods = get_class_methods('G_Error');
|
||||
foreach ($class_methods as $method_name) {
|
||||
$methods[ $testItems ] = $method_name;
|
||||
$testItems++;
|
||||
}
|
||||
|
||||
$t = new lime_test(11, new lime_output_color());
|
||||
|
||||
$t->diag('class error' );
|
||||
//
|
||||
$t->is( $testItems , 13, "class G_Error " . 13 . " methods." );
|
||||
$t->isa_ok( $obj , 'G_Error', 'class G_Error created');
|
||||
$t->is( G_ERROR , -100, 'G_ERROR constant defined');
|
||||
$t->is( G_ERROR_ALREADY_ASSIGNED , -118, 'G_ERROR_ALREADY_ASSIGNED defined');
|
||||
|
||||
$obj = new G_Error( "string" );
|
||||
$t->is( $obj->code, -1, 'default code error');
|
||||
$t->is( $obj->message, "G Error: string", 'default message error');
|
||||
$t->is( $obj->level, E_USER_NOTICE, 'default level error');
|
||||
|
||||
$obj = new G_Error( G_ERROR_SYSTEM_UID );
|
||||
$t->is( $obj->code, -105, 'code error');
|
||||
$t->is( $obj->message, "G Error: ", 'message error');
|
||||
|
||||
$t->can_ok( $obj, "errorMessage", "exists method errorMessage");
|
||||
$msg = $obj->errorMessage ( G_ERROR );
|
||||
//$t->is( $msg->code, -100, 'fail in method errorMessage');
|
||||
$t->todo( 'fail in method errorMessage');
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classFilterFormTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
|
||||
require_once( $unitFilename );
|
||||
|
||||
require_once( PATH_THIRDPARTY . '/lime/lime.php');
|
||||
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
|
||||
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'filterForm');
|
||||
require_once( 'propel/Propel.php' );
|
||||
require_once ( "creole/Creole.php" );
|
||||
require_once ( PATH_CORE . "config/databases.php");
|
||||
|
||||
$obj = new filterForm ( 'login/login');
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$methods = get_class_methods('filterForm');
|
||||
$t = new lime_test(4, new lime_output_color());
|
||||
$t->diag('class filterForm' );
|
||||
$t->is( count($methods) , 12, "class filterForm " . count($methods) . " methods." );
|
||||
$t->isa_ok( $obj , 'filterForm', 'class filterForm created');
|
||||
$t->can_ok( $obj, 'render', 'render()');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classFormTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
|
||||
require_once( $unitFilename );
|
||||
|
||||
require_once( PATH_THIRDPARTY . '/lime/lime.php');
|
||||
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
|
||||
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
require_once( 'propel/Propel.php' );
|
||||
require_once ( "creole/Creole.php" );
|
||||
require_once ( PATH_CORE . "config/databases.php");
|
||||
$counter=1;
|
||||
$obj = new Form ( 'login/login');
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$methods = get_class_methods('Form');
|
||||
$t = new lime_test(15, new lime_output_color());
|
||||
$t->diag('class Form' );
|
||||
$t->is( count($methods) , 12, "class Form " . count($methods) . " methods." );
|
||||
$t->can_ok( $obj, 'Form',$counter++.' Form()');
|
||||
$t->can_ok( $obj, 'setDefaultValues',$counter++.' setDefaultValues()');
|
||||
$t->can_ok( $obj, 'printTemplate', $counter++.' printTemplate()');
|
||||
$t->can_ok( $obj, 'render', $counter++.' render()');
|
||||
$t->can_ok( $obj, 'setValues', $counter++.' setValues()');
|
||||
$t->can_ok( $obj, 'getFields', $counter++.' getFields()');
|
||||
$t->can_ok( $obj, 'validatePost', $counter++.' validatePost()');
|
||||
$t->can_ok( $obj, 'validateArray', $counter++.' validateArray()');
|
||||
$t->can_ok( $obj, 'getVars', $counter++.' getVars()');
|
||||
$t->can_ok( $obj, 'validateRequiredFields', $counter++.' validateRequiredFields()');
|
||||
$t->can_ok( $obj, 'parseFile', $counter++.' parseFile()');
|
||||
$t->can_ok( $obj, 'cloneObject', $counter++.' cloneObject()');
|
||||
$t->is( count($methods) , --$counter , "ok");
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,276 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classGTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
require_once( PATH_THIRDPARTY . '/lime/lime.php');
|
||||
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
|
||||
require_once( PATH_GULLIVER .'class.g.php');
|
||||
$obj = new G();
|
||||
$methods = get_class_methods('G');
|
||||
$t = new lime_test( 223, new lime_output_color());
|
||||
$t->diag('class G' );
|
||||
$t->is( count($methods) , 95, "class G " . 95 . " methods." );
|
||||
$t->isa_ok( $obj , 'G', 'class G created');
|
||||
$t->todo( 'review which PHP version is the minimum for Gulliver');
|
||||
$t->is( G::getVersion() , '3.0-1', 'Gulliver version');
|
||||
$t->todo( 'store the version in a file');
|
||||
$t->is( $obj->getIpAddress() , false, 'getIpAddress()');
|
||||
$t->isnt( $obj->getMacAddress() , '', 'getMacAddress()');
|
||||
$t->can_ok( $obj, 'microtime_float', 'microtime_float()');
|
||||
$t->can_ok( $obj, 'setFatalErrorHandler' , 'setFatalErrorHandler()');
|
||||
$t->can_ok( $obj, 'setErrorHandler', 'setErrorHandler()');
|
||||
$t->is( $obj->fatalErrorHandler( 'Fatal error') , 'Fatal error', 'fatalErrorHandler()');
|
||||
$like = '<table cellpadding=1 cellspacing=0 border=0 bgcolor=#808080 width=250><tr><td ><table cellpadding=2 cellspacing=0 border=0 bgcolor=white width=100%><tr bgcolor=#d04040><td colspan=2 nowrap><font color=#ffffaa><code> ERROR CAUGHT check log file</code></font></td></tr><tr ><td colspan=2 nowrap><font color=black><code>IP address: </code></font></td></tr> </table></td></tr></table>';
|
||||
$t->is( $obj->fatalErrorHandler( 'error</b>:abc<br>') , $like, 'fatalErrorHandler()');
|
||||
$t->can_ok( $obj, 'customErrorHandler', 'customErrorHandler()');
|
||||
|
||||
G::customErrorHandler ( G_DB_ERROR, "message error", "filename", 10, "context" ) ;
|
||||
$t->can_ok( $obj, 'showErrorSource', 'showErrorSource()');
|
||||
$t->can_ok( $obj, 'customErrorLog', 'customErrorLog()');
|
||||
$t->can_ok( $obj, 'verboseError', 'verboseError()');
|
||||
$t->can_ok( $obj, 'encrypt', 'encrypt()');
|
||||
$k = URL_KEY;
|
||||
$t->is( G::encrypt ("/sysOpenSource", $k), 'Ytap33°jmZ7D46bf2Jo', 'encrypt only workspace');
|
||||
$t->is( G::encrypt ("/sysOpenSource/", $k), 'Ytap33°jmZ7D46bf2Jpo', 'encrypt terminal slash');
|
||||
$t->is( G::encrypt ("/sysOpenSource/en", $k), 'Ytap33°jmZ7D46bf2Jpo158', 'encrypt two levels');
|
||||
$t->is( G::encrypt ("/sysOpenSource/en/test/login/login", $k), 'Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4A', 'encrypt normal page');
|
||||
$t->is( G::encrypt ("/sysOpenSource/en/test/login/login/demo", $k), 'Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4GDRmNCf', 'encrypt additional level');
|
||||
$t->is( G::encrypt ("/sysOpenSource/en/test/login/login?a=1&b=2", $k), 'Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4HDOcJRWzm2l', 'encrypt normal query string');
|
||||
$t->todo( 'encrypt query string plus pipe');
|
||||
$t->todo("encrypt query string plus pipe");
|
||||
$t->can_ok( $obj, 'decrypt', 'decrypt()');
|
||||
$t->is( G::decrypt ('Ytap33°jmZ7D46bf2Jo', $k), "/sysOpenSource", 'decrypt only workspace');
|
||||
$t->is( G::decrypt ('Ytap33°jmZ7D46bf2Jpo', $k), "/sysOpenSource/", 'decrypt terminal slash');
|
||||
$t->is( G::decrypt ('Ytap33°jmZ7D46bf2Jpo158', $k), "/sysOpenSource/en", 'decrypt two levels');
|
||||
$t->is( G::decrypt ('Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4A', $k), "/sysOpenSource/en/test/login/login", 'decrypt normal page');
|
||||
$t->is( G::decrypt ('Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4GDRmNCf', $k), "/sysOpenSource/en/test/login/login/demo", 'decrypt additional level');
|
||||
$t->is( G::decrypt ('Ytap33°jmZ7D46bf2Jpo15+cp8ij4F°fo5fZ4mDZ5Jyi4HDOcJRWzm2l', $k) , "/sysOpenSource/en/test/login/login?a=1&b=2",'decrypt normal query string');
|
||||
$t->todo( 'decrypt query string plus pipe');
|
||||
$t->can_ok( $obj, 'lookup', 'lookup()');
|
||||
$t->is( G::lookup ('optimusprime.colosa.net'), "192.168.1.22", 'lookup any address');
|
||||
$t->can_ok( $obj, 'mk_dir', 'mk_dir()');
|
||||
$newDir = '/tmp/test/directory';
|
||||
$r = G::verifyPath ( $newDir );
|
||||
|
||||
if ( $r ) rmdir ( $newDir );
|
||||
$r = G::mk_dir ( $newDir );
|
||||
$r = G::verifyPath ( $newDir);
|
||||
$t->is( $r, true, "mk_dir() $newDir");
|
||||
$t->can_ok( $obj, 'verifyPath', "verifyPath() $newDir");
|
||||
$t->isnt( PATH_CORE, 'PATH_CORE', 'Constant PATH_CORE');
|
||||
$t->isnt( PATH_GULLIVER, 'PATH_GULLIVER', 'Constant PATH_GULLIVER');
|
||||
$phatSitio = "/home/arturo/processmaker/trunk/workflow/engine/class.x.php/";
|
||||
$phatBuscar = "/processmaker/trunk/workflow/engine/class.x.php/";
|
||||
// The ereg function has been DEPRECATED as of PHP 5.3.0.
|
||||
// $t->is(( ereg( $phatBuscar , $phatSitio ) ), 1 , 'expandPath()');
|
||||
$t->is(( preg_match( '/' . $phatBuscar . '/', $phatSitio ) ), 1 , 'expandPath()');
|
||||
$t->is( G::LoadSystem("error"), NULL, 'LoadSystem()');
|
||||
$t->can_ok( $obj, 'RenderPage', 'RenderPage()');
|
||||
$t->can_ok( $obj, 'LoadSkin', 'LoadSkin()');
|
||||
$t->can_ok( $obj, 'LoadInclude', 'LoadInclude()');
|
||||
$t->can_ok( $obj, 'LoadTemplate', 'LoadTemplate()');
|
||||
$t->can_ok( $obj, 'LoadClassRBAC', 'LoadClassRBAC()');
|
||||
$t->can_ok( $obj, 'LoadClass', 'LoadClass()');
|
||||
$t->can_ok( $obj, 'LoadThirdParty', 'LoadThirdParty()');
|
||||
$t->can_ok( $obj, 'encryptlink', 'encryptlink()');
|
||||
$t->is( G::encryptlink("normal url"), "normal url", 'encryptlink() normal url');
|
||||
$t->todo( 'more tests with encryplink and remove ENABLE_ENCRYPT dependency');
|
||||
$t->can_ok( $obj, 'parseURI', 'parseURI()');
|
||||
|
||||
G::parseURI("http:/192.168.0.9/sysos/en/wf5/login/login/abc?ab=123&bc=zy");
|
||||
$t->todo( 'more tests with parseURI');
|
||||
$t->can_ok( $obj, 'streamFile', 'streamFile()');
|
||||
$t->can_ok( $obj, 'sendHeaders', 'sendHeaders()');
|
||||
$t->todo( 'more tests with sendHeaders');
|
||||
$t->can_ok( $obj, 'virtualURI', 'virtualURI()');
|
||||
$t->can_ok( $obj, 'createUID', 'createUID()');
|
||||
$t->is( G::createUID('directory','filename'), 'bDh5aTBaUG5vNkxwMnByWjJxT2EzNVk___', 'createUID() normal');
|
||||
$t->can_ok( $obj, 'getUIDName', 'getUIDName()');
|
||||
$t->is( G::getUIDName('bDh5aTBaUG5vNkxwMnByWjJxT2EzNVk___','12345678901234567890'), false, 'getUIDName() normal?');
|
||||
$t->can_ok( $obj, 'formatNumber', 'formatNumber()');
|
||||
$t->is( G::formatNumber('100000'), '100000', 'formatNumber() normal');
|
||||
$t->todo( 'is useful the function formatNumber??');
|
||||
$t->can_ok( $obj, 'formatDate', 'formatDate()');
|
||||
$t->is( G::formatDate( '2001-02-29' ), '2001-02-29', 'formatDate() ');
|
||||
$t->is( G::formatDate( '2001-02-29', 'F d, Y' ), 'Februar01 29, 2001', 'formatDate() '); //is not working
|
||||
$t->is( G::formatDate( '2001-02-29', 'd.m.Y' ), '29.02.2001', 'formatDate() ');
|
||||
$t->todo( " the month literal text is defined here!! ");
|
||||
$t->todo( 'review all methods in class G');
|
||||
$i=1;
|
||||
$t->diag('class G' );
|
||||
$t->is( count($methods) , 95, "class database " . count($methods) . " methods." );
|
||||
$t->is( $methods[0] , 'is_https' ,$i++.' is_https');
|
||||
$t->is( $methods[1] , 'array_fill_value' ,$i++.' array_fill_value');
|
||||
$t->is( $methods[2] , 'generate_password' ,$i++.' generate_password');
|
||||
$t->is( $methods[3] , 'array_concat' ,$i++.' array_concat');
|
||||
$t->is( $methods[4] , 'var_compare' ,$i++.' var_compare');
|
||||
$t->is( $methods[5] , 'var_probe' ,$i++.' var_probe');
|
||||
$t->is( $methods[6] , 'getVersion' ,$i++.' getVersion');
|
||||
$t->is( G::getVersion() , '3.0-1', 'Gulliver version 3.0-1');
|
||||
$t->is( $methods[7] , 'getIpAddress' ,$i++.' getIpAddress');
|
||||
$t->is( $obj->getIpAddress() , false, 'getIpAddress()');
|
||||
$t->is( $methods[8] , 'getMacAddress' ,$i++.' getMacAddress');
|
||||
$t->isnt( $obj->getMacAddress() , '', 'getMacAddress()');
|
||||
$t->is( $methods[9] , 'microtime_float' ,$i++.' microtime_float');
|
||||
$t->can_ok( $obj, 'microtime_float', 'microtime_float()');
|
||||
$t->is( $methods[10] , 'setFatalErrorHandler',$i++.' setFatalErrorHandler');
|
||||
$t->can_ok( $obj, 'setFatalErrorHandler' , 'setFatalErrorHandler()');
|
||||
$t->is( $methods[11] , 'setErrorHandler' ,$i++.' setErrorHandler');
|
||||
$t->can_ok( $obj, 'setErrorHandler', 'setErrorHandler()');
|
||||
$t->is( $methods[12] , 'fatalErrorHandler' ,$i++.' fatalErrorHandler');
|
||||
$t->is( $methods[13] , 'customErrorHandler' ,$i++.' customErrorHandler');
|
||||
$t->is( $methods[14] , 'showErrorSource' ,$i++.' showErrorSource');
|
||||
$t->is( $methods[15] , 'customErrorLog' ,$i++.' customErrorLog');
|
||||
$t->is( $methods[16] , 'verboseError' ,$i++.' verboseError');
|
||||
$t->is( $methods[17] , 'encrypt' ,$i++.' encrypt');
|
||||
$t->is( $methods[18] , 'decrypt' ,$i++.' decrypt');
|
||||
$t->is( $methods[19] , 'lookup' ,$i++.' lookup');
|
||||
$t->is( $methods[20] , 'mk_dir' ,$i++.' mk_dir');
|
||||
$t->is( $methods[21] , 'rm_dir' ,$i++.' rm_dir');
|
||||
$t->is( $methods[22] , 'verifyPath' ,$i++.' verifyPath');
|
||||
$t->is( $methods[23] , 'expandPath' ,$i++.' expandPath');
|
||||
$t->is( $methods[24] , 'LoadSystem' ,$i++.' LoadSystem');
|
||||
$t->is( $methods[25] , 'RenderPage' ,$i++.' RenderPage');
|
||||
$t->is( $methods[26] , 'LoadSkin' ,$i++.' LoadSkin');
|
||||
$t->is( $methods[27] , 'LoadInclude' ,$i++. ' LoadInclude');
|
||||
$t->is( $methods[28] , 'LoadAllModelClasses',$i++. ' LoadAllModelClasses');
|
||||
$t->is( $methods[29] , 'LoadAllPluginModelClasses',$i++. ' LoadAllPluginModelClasses');
|
||||
$t->is( $methods[30] , 'LoadTemplate' ,$i++. ' LoadTemplate');
|
||||
$t->is( $methods[31] , 'LoadClassRBAC' ,$i++. ' LoadClassRBAC');
|
||||
$t->is( $methods[32] , 'LoadClass' ,$i++. ' LoadClass');
|
||||
$t->is( $methods[33] , 'LoadThirdParty' ,$i++. ' LoadThirdParty');
|
||||
$t->is( $methods[34] , 'encryptlink' ,$i++. ' encryptlink');
|
||||
$t->is( $methods[35] , 'parseURI' ,$i++. ' parseURI');
|
||||
$t->is( $methods[36] , 'streamFile' ,$i++. ' streamFile');
|
||||
$t->is( $methods[37] , 'trimSourceCodeFile' ,$i++. ' trimSourceCodeFile');
|
||||
$t->is( $methods[38] , 'sendHeaders' ,$i++. ' sendHeaders');
|
||||
$t->is( $methods[39] , 'virtualURI' ,$i++. ' virtualURI');
|
||||
$t->is( $methods[40] , 'createUID' ,$i++. ' createUID');
|
||||
$t->is( $methods[41] , 'getUIDName' ,$i++. ' getUIDName');
|
||||
$t->is( $methods[42] , 'formatNumber' ,$i++. ' formatNumber');
|
||||
$t->is( $methods[43] , 'formatDate' ,$i++. ' formatDate');
|
||||
$t->is( $methods[44] , 'getformatedDate' ,$i++. ' getformatedDate');
|
||||
$t->is( $methods[45] , 'arrayDiff' ,$i++. ' arrayDiff');
|
||||
$t->is( $methods[46] , 'complete_field' ,$i++. ' complete_field');
|
||||
$t->is( $methods[47] , 'sqlEscape' ,$i++. ' sqlEscape');
|
||||
$t->is( $methods[48] , 'replaceDataField' ,$i++. ' replaceDataField');
|
||||
$t->can_ok( $obj, 'replaceDataField', 'replaceDataField()');
|
||||
$t->todo( 'improve the function replaceDataField !!');
|
||||
$t->is( $methods[49] , 'loadLanguageFile' ,$i++. ' loadLanguageFile');
|
||||
$t->can_ok( $obj, 'loadLanguageFile', 'loadLanguageFile()');
|
||||
$t->todo( 'more tests with the function loadLanguageFile !!');
|
||||
$t->is( $methods[50] , 'registerLabel' ,$i++. ' registerLabel');
|
||||
$t->can_ok( $obj, 'registerLabel', 'registerLabel()');
|
||||
$t->todo( 'more tests with the function registerLabel !!');
|
||||
$t->is( $methods[51] , 'LoadMenuXml' ,$i++. ' LoadMenuXml');
|
||||
$t->can_ok( $obj, 'LoadMenuXml', 'LoadMenuXml()');
|
||||
$t->todo( 'more tests with the function LoadMenuXml !!');
|
||||
$t->is( $methods[52] , 'SendMessageXml' ,$i++. ' SendMessageXml');
|
||||
$t->can_ok( $obj, 'SendMessageXml', 'SendMessageXml()');
|
||||
$t->todo( 'more tests with the function SendMessageXml !!');
|
||||
$t->is( $methods[53] , 'SendTemporalMessage',$i++. ' SendTemporalMessage');
|
||||
$t->is( $methods[54] , 'SendMessage' ,$i++. ' SendMessage');
|
||||
$t->can_ok( $obj, 'SendTemporalMessage', 'SendTemporalMessage()');
|
||||
$t->todo( 'more tests with the function SendTemporalMessage !!');
|
||||
$t->can_ok( $obj, 'SendMessage', 'SendMessage()');
|
||||
$t->todo( 'more tests with the function SendMessage !!');
|
||||
$t->is( $methods[55] , 'SendMessageText' ,$i++. ' SendMessageText');
|
||||
$t->is( $methods[56] , 'LoadMessage' ,$i++. ' LoadMessage');
|
||||
$t->can_ok( $obj, 'LoadMessage', 'LoadMessage()');
|
||||
$t->todo( 'more tests with the function LoadMessage !!');
|
||||
$t->is( $methods[57] , 'LoadXmlLabel' ,$i++. ' LoadXmlLabel');
|
||||
$t->can_ok( $obj, 'LoadXmlLabel', 'LoadXmlLabel()');
|
||||
$t->todo( 'is useful the function LoadXmlLabel ??? delete it!!');
|
||||
$t->is( $methods[58] , 'LoadMessageXml' ,$i++. ' LoadMessageXml');
|
||||
$t->can_ok( $obj, 'LoadMessageXml', 'LoadMessageXml()');
|
||||
$t->todo( 'more tests with the function LoadMessageXml !!');
|
||||
$t->is( $methods[59] , 'LoadTranslationObject',$i++. ' LoadTranslationObject');
|
||||
$t->can_ok( $obj, 'LoadTranslation', 'LoadTranslation()');
|
||||
$t->todo( 'more tests with the function LoadTranslation !!');
|
||||
$t->is( $methods[60] , 'LoadTranslation' ,$i++. ' LoadTranslation');
|
||||
$t->is( $methods[61] , 'LoadArrayFile' ,$i++. ' LoadArrayFile');
|
||||
$t->can_ok( $obj, 'LoadArrayFile', 'LoadArrayFile()');
|
||||
$t->todo( 'more tests with the function LoadArrayFile !!');
|
||||
$t->is( $methods[62] , 'expandUri' ,$i++. ' expandUri');
|
||||
$t->can_ok( $obj, 'expandUri', 'expandUri()');
|
||||
$t->todo( 'more tests with the function expandUri !!');
|
||||
$t->is( $methods[63] , 'genericForceLogin' ,$i++. ' genericForceLogin');
|
||||
$t->can_ok( $obj, 'genericForceLogin', 'genericForceLogin()');
|
||||
$t->todo( 'more tests with the function genericForceLogin !!');
|
||||
$t->is( $methods[64] , 'capitalize' ,$i++. ' capitalize');
|
||||
$t->is( $methods[65] , 'toUpper' ,$i++. ' toUpper');
|
||||
$t->is( $methods[66] , 'toLower' ,$i++. ' toLower');
|
||||
$t->is( $methods[67] , 'http_build_query' ,$i++. ' http_build_query');
|
||||
$t->is( $methods[68] , 'header' ,$i++. ' header');
|
||||
$t->can_ok( $obj, 'http_build_query', 'http_build_query()');
|
||||
$t->todo( 'more tests with the function http_build_query !!');
|
||||
$t->can_ok( $obj, 'header', 'header()');
|
||||
$t->todo( 'more tests with the function header !!');
|
||||
$t->is( $methods[69] , 'forceLogin' ,$i++. ' forceLogin');
|
||||
$t->can_ok( $obj, 'forceLogin', 'forceLogin()');
|
||||
$t->todo( 'more tests with the function forceLogin , DELETE IT!!');
|
||||
$t->is( $methods[70] , 'add_slashes' ,$i++. ' add_slashes');
|
||||
$t->can_ok( $obj, 'add_slashes', 'add_slashes()');
|
||||
$t->todo( 'more tests with the function add_slashes !!');
|
||||
$t->is( $methods[71] , 'uploadFile' ,$i++. ' uploadFile');
|
||||
$t->can_ok( $obj, 'uploadFile', 'uploadFile()');
|
||||
$t->todo( 'more tests with the function uploadFile !!');
|
||||
$t->is( $methods[72] , 'resizeImage' ,$i++. ' resizeImage');
|
||||
$t->is( $methods[73] , 'array_merges' ,$i++. ' array_merges');
|
||||
$t->can_ok( $obj, 'array_merges', 'array_merges()');
|
||||
$t->todo( 'more tests with the function array_merges !!');
|
||||
$t->is( $methods[74] , 'array_merge_2' ,$i++. ' array_merge_2');
|
||||
$t->can_ok( $obj, 'array_merge_2', 'array_merge_2()');
|
||||
$t->todo( 'more tests with the function array_merge_2 !!');
|
||||
$t->is( $methods[75] , 'generateUniqueID' ,$i++. ' generateUniqueID');
|
||||
$t->can_ok( $obj, 'generateUniqueID', 'generateUniqueID()');
|
||||
$t->todo( 'more tests with the function sqlEscape !! is useful? delete it !!');
|
||||
$t->can_ok( $obj, 'generateUniqueID', 'generateUniqueID()');
|
||||
$t->todo( 'more tests with the function sqlEscape !! is useful? delete it !!');
|
||||
$t->is( $methods[76] , 'generateCode' ,$i++. ' generateCode');
|
||||
$t->is( $methods[77] , 'verifyUniqueID' ,$i++. ' verifyUniqueID');
|
||||
$t->is( $methods[78] , 'is_utf8' ,$i++. ' is_utf8');
|
||||
$t->is( $methods[79] , 'CurDate' ,$i++. ' CurDate');
|
||||
$t->can_ok( $obj, 'CurDate', 'CurDate()');
|
||||
$t->todo( 'more tests with the function sqlEscape !!');
|
||||
$t->is( $methods[80] , 'getSystemConstants',$i++. ' getSystemConstants');
|
||||
$t->is( $methods[81] , 'capitalizeWords' ,$i++. ' capitalizeWords');
|
||||
$t->is( $methods[82] , 'unhtmlentities' ,$i++. ' unhtmlentities');
|
||||
$t->is( $methods[83] , 'xmlParser' ,$i++. ' xmlParser');
|
||||
$t->is( $methods[84] , '_del_p' ,$i++. ' _del_p');
|
||||
$t->is( $methods[85] , 'ary2xml' ,$i++. ' ary2xml');
|
||||
$t->is( $methods[86] , 'ins2ary' ,$i++. ' ins2ary');
|
||||
$t->is( $methods[87] , 'evalJScript' ,$i++. ' evalJScript');
|
||||
$t->is( $methods[88] , 'inflect' ,$i++. ' inflect');
|
||||
$t->is( $methods[89] , 'pr' ,$i++. ' pr');
|
||||
$t->is( $methods[90] , 'dump' ,$i++. ' dump');
|
||||
$t->is( $methods[91] , 'stripCDATA' ,$i++. ' stripCDATA');
|
||||
$t->is( $methods[92] , 'sys_get_temp_dir' ,$i++. ' sys_get_temp_dir');
|
||||
$t->is( $methods[93] , 'PMWSCompositeResponse' ,$i++. ' PMWSCompositeResponse');
|
||||
$t->is( $methods[94] , 'emailAddress' ,$i++. ' emailAddress');
|
||||
$t->is( count( $methods ) , --$i , count( $methods ).' = '.$i.' ok');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classHeadPublisherTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
|
||||
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'headPublisher');
|
||||
$counter=1;
|
||||
$t = new lime_test( 13 , new lime_output_color());
|
||||
|
||||
$obj =& headPublisher::getSingleton();
|
||||
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$methods = get_class_methods('headPublisher');
|
||||
|
||||
$t->diag('class headPublisher' );
|
||||
$t->is( 10 ,count($methods) , "class headPublisher " . count($methods) . " methods." );
|
||||
$t->isa_ok( $obj, 'headPublisher', $counter++.' class headPublisher created');
|
||||
$t->can_ok( $obj, 'getSingleton', $counter++.' getSingleton()');
|
||||
$t->can_ok( $obj, 'setTitle', $counter++.' setTitle()');
|
||||
$t->can_ok( $obj, 'addScriptFile', $counter++.' addScriptFile()');
|
||||
$t->can_ok( $obj, 'addInstanceModule',$counter++.' addInstanceModule()');
|
||||
$t->can_ok( $obj, 'addClassModule', $counter++.' addClassModule()');
|
||||
$t->can_ok( $obj, 'addScriptCode', $counter++.' addScriptCode()');
|
||||
$t->can_ok( $obj, 'printHeader', $counter++.' printHeader()');
|
||||
$t->can_ok( $obj, 'printRawHeader', $counter++.' printRawHeader()');
|
||||
$t->can_ok( $obj, 'clearScripts', $counter++.' clearScripts()');
|
||||
$t->is( count($methods) ,--$counter , " methods ". $counter." OK" );
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classMailerTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'mailer');
|
||||
$obj = new mailer ();
|
||||
$testItems = 0;
|
||||
$method = get_class_methods('mailer');
|
||||
$t = new lime_test(11, new lime_output_color());
|
||||
$t->diag('class mailer' );
|
||||
$t->is( count($method) , 7, "class mailer " . count($method) . " methods." );
|
||||
$t->isa_ok( $obj , 'mailer', 'class mailer created');
|
||||
$t->can_ok( $obj, 'instanceMailer', 'instanceMailer()');
|
||||
$t->can_ok( $obj, 'arpaEMAIL', 'arpaEMAIL()');
|
||||
$t->can_ok( $obj, 'sendTemplate', 'sendTemplate()');
|
||||
$t->can_ok( $obj, 'sendHtml', 'sendHtml()');
|
||||
$t->can_ok( $obj, 'sendText', 'sendText()');
|
||||
$t->can_ok( $obj, 'replaceFields', 'replaceFields()');
|
||||
$t->can_ok( $obj, 'html2text', 'html2text()');
|
||||
$t->todo( 'delete function html2text !!!');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classMenuTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'menu');
|
||||
|
||||
$obj = new Menu ();
|
||||
$counter=1;
|
||||
$method = get_class_methods('Menu');print_r($class_methods);
|
||||
$t = new lime_test(15, new lime_output_color());
|
||||
$t->diag('class Menu' );
|
||||
$t->is( count($method) , 11, "class Menu " . count($method) . " methods." );
|
||||
$t->isa_ok( $obj , 'Menu', 'class Menu created');
|
||||
$t->can_ok( $obj, 'SetClass' , $counter++.' SetClass()');
|
||||
$t->can_ok( $obj, 'Load' , $counter++.' Load()');
|
||||
$t->can_ok( $obj, 'OptionCount' , $counter++.' OptionCount()');
|
||||
$t->can_ok( $obj, 'AddOption' , $counter++.' AddOption()');
|
||||
$t->can_ok( $obj, 'AddIdOption' , $counter++.' AddIdOption()');
|
||||
$t->can_ok( $obj, 'AddRawOption' , $counter++.' AddRawOption()');
|
||||
$t->can_ok( $obj, 'AddIdRawOption' , $counter++.' AddIdRawOption()');
|
||||
$t->can_ok( $obj, 'DisableOptionPos', $counter++.' DisableOptionPos()');
|
||||
$t->can_ok( $obj, 'DisableOptionId' , $counter++.' DisableOptionId()');
|
||||
$t->can_ok( $obj, 'RenderOption' , $counter++.' RenderOption()');
|
||||
$t->can_ok( $obj, 'generateArrayForTemplate', $counter++.' generateArrayForTemplate()');
|
||||
$t->is( count($method) , --$counter , " methods " );
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classObjectTemplateTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'objectTemplate');
|
||||
|
||||
$obj = new objectTemplate ( '');
|
||||
$method = get_class_methods('objectTemplate');
|
||||
$t = new lime_test( 4, new lime_output_color());
|
||||
$t->diag('class objectTemplate' );
|
||||
$t->is( count($method ) , 60, "class objectTemplate " . count($method ) . " methods." );
|
||||
$t->isa_ok( $obj , 'objectTemplate', 'class objectTemplate created');
|
||||
$t->can_ok( $obj, 'printObject', 'printObject()');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classPagedTableTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'pagedTable');
|
||||
|
||||
$t = new lime_test( 2, new lime_output_color());
|
||||
$obj = "pagedTable";
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$method = get_class_methods('pagedTable');
|
||||
$t->diag('class pagedTable' );
|
||||
$t->is( count($method) , 10, "class pagedTable " . $testItems . " methods." );
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classPublisherTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'publisher');
|
||||
$method = array ( );
|
||||
$testItems = 0;
|
||||
$method = get_class_methods('publisher');
|
||||
$t = new lime_test( 6, new lime_output_color());
|
||||
$obj = new Publisher ( 'field' );
|
||||
$t->diag('class Publisher' );
|
||||
$t->is( count($method) , 3, "class publisher " . count($method) . " methods." );
|
||||
$t->isa_ok( $obj , 'Publisher' , 'class Publisher created');
|
||||
$t->can_ok( $obj , 'AddContent' , 'AddContent()');
|
||||
$t->can_ok( $obj , 'RenderContent' , 'RenderContent()');
|
||||
$t->can_ok( $obj , 'RenderContent0', 'RenderContent0()');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* classRbacTest.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
||||
}
|
||||
|
||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
global $G_ENVIRONMENTS;
|
||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
||||
if ( !file_exists ( $dbfile ) ) {
|
||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
||||
exit (200);
|
||||
}
|
||||
else
|
||||
include ( $dbfile );
|
||||
}
|
||||
else
|
||||
exit (201);
|
||||
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem ( 'xmlform');
|
||||
G::LoadSystem ( 'xmlDocument');
|
||||
G::LoadSystem ( 'form');
|
||||
G::LoadSystem ( 'rbac');
|
||||
|
||||
$method = array ( );
|
||||
$method = get_class_methods('RBAC');
|
||||
$t = new lime_test( 8, new lime_output_color());
|
||||
$obj =& RBAC::getSingleton();
|
||||
$t->diag('class RBAC' );
|
||||
$t->is( count($method), 46, "class RBAC " . count($method) . " methods." );
|
||||
$t->isa_ok( $obj, 'RBAC', 'class RBAC created');
|
||||
$t->can_ok( $obj, 'VerifyLogin', 'VerifyLogin()');
|
||||
$t->can_ok( $obj, 'userCanAccess', 'userCanAccess()');
|
||||
$t->can_ok( $obj, 'load', 'load()');
|
||||
$t->can_ok( $obj, 'createUser', 'createUser()');
|
||||
$t->can_ok( $obj, 'listAllRoles', 'listAllRoles()');
|
||||
$t->todo( 'review all pendings in this class');
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user