Arreglo a behat para events
This commit is contained in:
@@ -1,8 +1,17 @@
|
|||||||
@ProcessMakerMichelangelo @RestAPI
|
@ProcessMakerMichelangelo @RestAPI
|
||||||
Feature: Testing events
|
Feature: Events Resources
|
||||||
|
|
||||||
@1: TEST FOR POST EVENT /----------------------------------------------------------------------
|
@1: TEST FOR GET EVENTS /----------------------------------------------------------------------
|
||||||
Scenario: Create a event
|
Scenario: List all the events (result 0 events)
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And I request "project/251815090529619a99a2bf4013294414/events"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the response has 0 record
|
||||||
|
|
||||||
|
|
||||||
|
@2: TEST FOR POST EVENT /----------------------------------------------------------------------
|
||||||
|
Scenario: Create a new event
|
||||||
Given that I have a valid access_token
|
Given that I have a valid access_token
|
||||||
And POST this data:
|
And POST this data:
|
||||||
"""
|
"""
|
||||||
@@ -24,8 +33,15 @@ Feature: Testing events
|
|||||||
Then the response status code should be 201
|
Then the response status code should be 201
|
||||||
And store "evn_uid" in session array
|
And store "evn_uid" in session array
|
||||||
|
|
||||||
|
@3: TEST FOR GET EVENTS /----------------------------------------------------------------------
|
||||||
|
Scenario: List all the events (result 1 event)
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And I request "project/251815090529619a99a2bf4013294414/events"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the response has 1 record
|
||||||
|
|
||||||
@2: TEST FOR PUT EVENT /-----------------------------------------------------------------------
|
@4: TEST FOR PUT EVENT /-----------------------------------------------------------------------
|
||||||
Scenario: Update a event
|
Scenario: Update a event
|
||||||
Given that I have a valid access_token
|
Given that I have a valid access_token
|
||||||
And PUT this data:
|
And PUT this data:
|
||||||
@@ -51,8 +67,8 @@ Feature: Testing events
|
|||||||
And the type is "object"
|
And the type is "object"
|
||||||
|
|
||||||
|
|
||||||
@3: TEST FOR GET EVENT /-----------------------------------------------------------------------
|
@5: TEST FOR GET EVENT /-----------------------------------------------------------------------
|
||||||
Scenario: Get a event
|
Scenario: Get a event (with change in "evn_description")
|
||||||
Given that I have a valid access_token
|
Given that I have a valid access_token
|
||||||
And that I want to get a resource with the key "evn_uid" stored in session array
|
And that I want to get a resource with the key "evn_uid" stored in session array
|
||||||
And I request "project/251815090529619a99a2bf4013294414/event"
|
And I request "project/251815090529619a99a2bf4013294414/event"
|
||||||
@@ -62,7 +78,7 @@ Feature: Testing events
|
|||||||
And that "evn_description" is set to "change description"
|
And that "evn_description" is set to "change description"
|
||||||
|
|
||||||
|
|
||||||
@4: TEST FOR DELETE EVENT /-----------------------------------------------------------------------
|
@6: TEST FOR DELETE EVENT /-----------------------------------------------------------------------
|
||||||
Scenario: Delete a event
|
Scenario: Delete a event
|
||||||
Given that I have a valid access_token
|
Given that I have a valid access_token
|
||||||
And that I want to delete a resource with the key "evn_uid" stored in session array
|
And that I want to delete a resource with the key "evn_uid" stored in session array
|
||||||
@@ -70,3 +86,11 @@ Feature: Testing events
|
|||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the response charset is "UTF-8"
|
And the response charset is "UTF-8"
|
||||||
And the type is "object"
|
And the type is "object"
|
||||||
|
|
||||||
|
@7: TEST FOR GET EVENTS /----------------------------------------------------------------------
|
||||||
|
Scenario: List all the events (result 0 events)
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And I request "project/251815090529619a99a2bf4013294414/events"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the response has 0 record
|
||||||
@@ -1108,5 +1108,4 @@ class RestContext extends BehatContext
|
|||||||
throw new Exception('Records quantity not match ' . $quantityOfRecords . ' (actual: ' . $currentRecordsCount . ")\n\n");
|
throw new Exception('Records quantity not match ' . $quantityOfRecords . ' (actual: ' . $currentRecordsCount . ")\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ class Event
|
|||||||
*/
|
*/
|
||||||
public function getEvents($sProcessUID, $filter = '', $sEventUID = '')
|
public function getEvents($sProcessUID, $filter = '', $sEventUID = '')
|
||||||
{
|
{
|
||||||
|
$oProcess = new \Process();
|
||||||
|
if (!($oProcess->processExists($sProcessUID))) {
|
||||||
|
throw (new \Exception( 'This process doesn\'t exist!' ));
|
||||||
|
}
|
||||||
|
|
||||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||||
$oCriteria = new \Criteria('workflow');
|
$oCriteria = new \Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(\EventPeer::EVN_UID);
|
$oCriteria->addSelectColumn(\EventPeer::EVN_UID);
|
||||||
@@ -88,6 +93,12 @@ class Event
|
|||||||
if ( ($sProcessUID == '') || (count($dataEvent) == 0) ) {
|
if ( ($sProcessUID == '') || (count($dataEvent) == 0) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oProcess = new \Process();
|
||||||
|
if (!($oProcess->processExists($sProcessUID))) {
|
||||||
|
throw (new \Exception( 'This process doesn\'t exist!' ));
|
||||||
|
}
|
||||||
|
|
||||||
$dataEvent = array_change_key_case($dataEvent, CASE_UPPER);
|
$dataEvent = array_change_key_case($dataEvent, CASE_UPPER);
|
||||||
|
|
||||||
if ( $create && (isset($dataEvent['ENV_UID'])) ) {
|
if ( $create && (isset($dataEvent['ENV_UID'])) ) {
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ class ProcessPermissions
|
|||||||
/**
|
/**
|
||||||
* Get list for ProcessPermissions
|
* Get list for ProcessPermissions
|
||||||
* @var string $sProcessUID. Uid for Process
|
* @var string $sProcessUID. Uid for Process
|
||||||
* @var string $filter.
|
|
||||||
* @var string $sEventUID. Uid for Process
|
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -24,14 +22,16 @@ class ProcessPermissions
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getProcessPermissions($sProcessUID)
|
public function getProcessPermissions($sProcessUID, $sPermissionUid = '')
|
||||||
{
|
{
|
||||||
G::LoadClass('case');
|
G::LoadClass('case');
|
||||||
Cases::verifyTable();
|
Cases::verifyTable();
|
||||||
$aObjectsPermissions = array();
|
$aObjectsPermissions = array();
|
||||||
//$aObjectsPermissions[] = array('OP_UID' => 'char', 'TASK_TARGET' => 'char', 'GROUP_USER' => 'char', 'TASK_SOURCE' => 'char', 'OBJECT_TYPE' => 'char', 'OBJECT' => 'char', 'PARTICIPATED' => 'char', 'ACTION' => 'char', 'OP_CASE_STATUS' => 'char');
|
|
||||||
$oCriteria = new \Criteria('workflow');
|
$oCriteria = new \Criteria('workflow');
|
||||||
$oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
|
$oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
|
||||||
|
if ($sPermissionUid != '') {
|
||||||
|
$oCriteria->add(ObjectPermissionPeer::OP_UID, $sPermissionUid);
|
||||||
|
}
|
||||||
$oDataset = ObjectPermissionPeer::doSelectRS($oCriteria);
|
$oDataset = ObjectPermissionPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
@@ -155,6 +155,12 @@ class ProcessPermissions
|
|||||||
$aObjectsPermissions[] = array_merge($aRow, array('OP_UID' => $aRow['OP_UID'], 'TASK_TARGET' => $sTaskTarget, 'GROUP_USER' => $sUserGroup, 'TASK_SOURCE' => $sTaskSource, 'OBJECT_TYPE' => $sObjectType, 'OBJECT' => $sObject, 'PARTICIPATED' => $sParticipated, 'ACTION' => $sAction, 'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS']));
|
$aObjectsPermissions[] = array_merge($aRow, array('OP_UID' => $aRow['OP_UID'], 'TASK_TARGET' => $sTaskTarget, 'GROUP_USER' => $sUserGroup, 'TASK_SOURCE' => $sTaskSource, 'OBJECT_TYPE' => $sObjectType, 'OBJECT' => $sObject, 'PARTICIPATED' => $sParticipated, 'ACTION' => $sAction, 'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS']));
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($sPermissionUid != '' && empty($aObjectsPermissions)) {
|
||||||
|
throw (new \Exception( 'This row doesn\'t exist!' ));
|
||||||
|
} else if ($sPermissionUid != '' && !empty($aObjectsPermissions)) {
|
||||||
|
return current($aObjectsPermissions);
|
||||||
|
}
|
||||||
return $aObjectsPermissions;
|
return $aObjectsPermissions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,28 @@ class ProcessPermissions extends Api
|
|||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $projectUid {@min 1} {@max 32}
|
||||||
|
* @param string $objectPermissionUid {@min 1} {@max 32}
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
|
* @copyright Colosa - Bolivia
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @url GET /:projectUid/process-permission/:objectPermissionUid
|
||||||
|
*/
|
||||||
|
public function doGetProcessPermission($projectUid, $objectPermissionUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$processPermissions = new \BusinessModel\ProcessPermissions();
|
||||||
|
$response = $processPermissions->getProcessPermissions($projectUid, $objectPermissionUid);
|
||||||
|
return $response;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user