Merged in darojas/processmaker (pull request #347)
Se agrega test unit para cases INPUT DOCUMENTS. Se modifican respuestas de cases INPUT DOCUMENTS. Se modifica test unit de cases OUTPUT DOCUMENTS
This commit is contained in:
@@ -86,7 +86,8 @@ class InputDocument
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
$oResponse = json_decode(json_encode($result), false);
|
||||
return $oResponse;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -195,7 +196,6 @@ class InputDocument
|
||||
$_FILES["form"]["tmp_name"]
|
||||
);
|
||||
}
|
||||
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
|
||||
//Trigger - Execute after - Start
|
||||
$arrayField["APP_DATA"] = $case->executeTriggers(
|
||||
$taskUid,
|
||||
@@ -205,7 +205,7 @@ class InputDocument
|
||||
$arrayField["APP_DATA"]
|
||||
);
|
||||
//Trigger - Execute after - End
|
||||
}
|
||||
|
||||
//Save data
|
||||
$arrayData = array();
|
||||
$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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 = '';
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oInputDocument = new \BusinessModel\Cases\InputDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add a test InputDocument
|
||||
*
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddInputDocument()
|
||||
{
|
||||
\G::loadClass('pmFunctions');
|
||||
\G::loadClass('pmFunctions');
|
||||
$usrUid = '00000000000000000000000000000001';//an user id valid
|
||||
$proUid = '1265557095225ff5c688f46031700471';//a process id valid
|
||||
$tasUid = '46941969352af5be2ab3f39001216717';//a task id valid and related to the previous proUid
|
||||
$inpDocUid = '70158392952979dedd77fe0058957493';//a input document id valid and related to the previous task id
|
||||
$idCase = PMFNewCase($proUid, $usrUid, $tasUid, array());
|
||||
$case = new \Cases();
|
||||
$appDocUid = $case->addInputDocument($inpDocUid, $appDocUid = \G::generateUniqueID(), '', 'INPUT',
|
||||
'PHPUNIT TEST', '', $idCase, \AppDelegation::getCurrentIndex($idCase),
|
||||
$tasUid, $usrUid, "xmlform", '/home/user/desarrollo/test.txt', 0, '/home/user/desarrollo/test.txt');
|
||||
$aResponse = array();
|
||||
$aResponse = array_merge(array("idCase" => $idCase, "appDocUid" => $appDocUid, "inpDocUid" => $inpDocUid), $aResponse);
|
||||
return $aResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get InputDocuments
|
||||
*
|
||||
* @covers \BusinessModel\Cases\InputDocument::getCasesInputDocuments
|
||||
* @depends testAddInputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesInputDocuments(array $aResponse)
|
||||
{
|
||||
$response = $this->oInputDocument->getCasesInputDocuments($aResponse["idCase"], '00000000000000000000000000000001');
|
||||
$this->assertTrue(is_array($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get InputDocument
|
||||
*
|
||||
* @covers \BusinessModel\Cases\InputDocument::getCasesInputDocument
|
||||
* @depends testAddInputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesInputDocument(array $aResponse)
|
||||
{
|
||||
$response = $this->oInputDocument->getCasesInputDocument($aResponse["idCase"], '00000000000000000000000000000001', $aResponse["appDocUid"]);
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test remove InputDocument
|
||||
*
|
||||
* @covers \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));
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
||||
public function setUp()
|
||||
{
|
||||
$this->oOutputDocument = new \BusinessModel\Cases\OutputDocument();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,11 +40,13 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testAddCasesOutputDocument()
|
||||
{
|
||||
\G::loadClass('pmFunctions');
|
||||
$usrUid = '00000000000000000000000000000001';
|
||||
$proUid = '1265557095225ff5c688f46031700471';
|
||||
$tasUid = '1352844695225ff5fe54de2005407079';
|
||||
\G::loadClass('pmFunctions');
|
||||
$usrUid = '00000000000000000000000000000001';//an user id valid
|
||||
$proUid = '1265557095225ff5c688f46031700471';//a process id valid
|
||||
$tasUid = '46941969352af5be2ab3f39001216717';//a task id valid and related to the previous proUid
|
||||
$outDocUid = '64016692453346d546d0ad1037377043';//a output document id valid and related to the previous task id
|
||||
$idCase = PMFNewCase($proUid, $usrUid, $tasUid, array());
|
||||
$response = $this->oOutputDocument->addCasesOutputDocument($idCase, '10401087752fa8bc6f0cab6048419434', '00000000000000000000000000000001');
|
||||
$response = $this->oOutputDocument->addCasesOutputDocument($idCase, $outDocUid, '00000000000000000000000000000001');
|
||||
$this->assertTrue(is_object($response));
|
||||
$aResponse = json_decode(json_encode($response), true);
|
||||
$aResponse = array_merge(array("idCase" => $idCase), $aResponse);
|
||||
@@ -93,7 +94,6 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testRemoveOutputDocument(array $aResponse)
|
||||
{
|
||||
echo $aResponse["app_doc_uid"];
|
||||
$response = $this->oOutputDocument->removeOutputDocument($aResponse["app_doc_uid"]);
|
||||
$this->assertTrue(empty($response));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user