Se modifica test unit para INPUT DOCUMENTS (v. basic)

This commit is contained in:
Daniel Rojas
2014-04-07 10:06:53 -04:00
parent 33e65331a7
commit 67896d6103

View File

@@ -18,6 +18,53 @@ 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
*
@@ -39,20 +86,16 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
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());
$idCase = PMFNewCase(self::$proUid, self::$usrUid, self::$tasUid, array());
$case = new \Cases();
$appDocUid = $case->addInputDocument($inpDocUid, $appDocUid = \G::generateUniqueID(), '', 'INPUT',
$appDocUid = $case->addInputDocument(self::$inpUid, $appDocUid = \G::generateUniqueID(), '', 'INPUT',
'PHPUNIT TEST', '', $idCase, \AppDelegation::getCurrentIndex($idCase),
$tasUid, $usrUid, "xmlform", '/home/user/desarrollo/test.txt', 0, '/home/user/desarrollo/test.txt');
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" => $inpDocUid), $aResponse);
$aResponse = array_merge(array("idCase" => $idCase, "appDocUid" => $appDocUid, "inpDocUid" => self::$inpUid), $aResponse);
return $aResponse;
}
}
/**
* Test get InputDocuments
@@ -65,7 +108,7 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
*/
public function testGetCasesInputDocuments(array $aResponse)
{
$response = $this->oInputDocument->getCasesInputDocuments($aResponse["idCase"], '00000000000000000000000000000001');
$response = $this->oInputDocument->getCasesInputDocuments($aResponse["idCase"], self::$usrUid);
$this->assertTrue(is_array($response));
}
@@ -80,7 +123,7 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
*/
public function testGetCasesInputDocument(array $aResponse)
{
$response = $this->oInputDocument->getCasesInputDocument($aResponse["idCase"], '00000000000000000000000000000001', $aResponse["appDocUid"]);
$response = $this->oInputDocument->getCasesInputDocument($aResponse["idCase"], self::$usrUid, $aResponse["appDocUid"]);
$this->assertTrue(is_object($response));
}