Se agregan unit test para INPUT DOCUMENTS y se agregan validaciones

This commit is contained in:
Daniel Rojas
2014-04-07 15:13:55 -04:00
parent d2b0882af9
commit e08ff8d215
2 changed files with 66 additions and 0 deletions

View File

@@ -58,6 +58,10 @@ class InputDocument
public function getCasesInputDocument($applicationUid, $userUid, $inputDocumentUid)
{
try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This input document with id: '.$inputDocumentUid.' doesn\'t exist!'));
}
$sApplicationUID = $applicationUid;
$sUserUID = $userUid;
\G::LoadClass('case');

View File

@@ -97,6 +97,20 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
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
*
@@ -112,6 +126,38 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
$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
*
@@ -127,6 +173,22 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(is_object($response));
}
/**
* Test error for incorrect value of input document in array
*
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::removeInputDocument
* @depends testAddInputDocument
* @param array $aResponse
* @expectedException Exception
* @expectedExceptionMessage This input document with id: 12345678912345678912345678912345678 doesn't exist!
*
* @copyright Colosa - Bolivia
*/
public function testGetCasesInputDocumentErrorIncorrectApplicationValueArray(array $aResponse)
{
$this->oInputDocument->removeInputDocument('12345678912345678912345678912345678');
}
/**
* Test remove InputDocument
*