Se agregan unit test para OUTPUT DOCUMENTS, PROCESS CATEGORY, INPUTDOCUMENTS y se agregan validaciones para OUTPUT DOCUMENTS y PROCESS CATEGORY.
This commit is contained in:
@@ -56,6 +56,10 @@ class OutputDocument
|
|||||||
public function getCasesOutputDocument($applicationUid, $userUid, $applicationDocumentUid)
|
public function getCasesOutputDocument($applicationUid, $userUid, $applicationDocumentUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, 1 );
|
||||||
|
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
|
||||||
|
throw (new \Exception('This output document with id: '.$applicationDocumentUid.' doesn\'t exist!'));
|
||||||
|
}
|
||||||
$sApplicationUID = $applicationUid;
|
$sApplicationUID = $applicationUid;
|
||||||
$sUserUID = $userUid;
|
$sUserUID = $userUid;
|
||||||
\G::LoadClass('case');
|
\G::LoadClass('case');
|
||||||
|
|||||||
@@ -282,7 +282,10 @@ class ProcessCategory
|
|||||||
public function addCategory($cat_name)
|
public function addCategory($cat_name)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
require_once 'classes/model/ProcessCategory.php';
|
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "ProcessCategory.php");
|
||||||
|
if ($cat_name == '') {
|
||||||
|
throw (new \Exception( 'cat_name. Process Category name can\'t be null'));
|
||||||
|
}
|
||||||
$catName = trim( $cat_name );
|
$catName = trim( $cat_name );
|
||||||
if ($this->existsName( $cat_name )) {
|
if ($this->existsName( $cat_name )) {
|
||||||
throw (new \Exception( 'cat_name. Duplicate Process Category name'));
|
throw (new \Exception( 'cat_name. Duplicate Process Category name'));
|
||||||
@@ -312,7 +315,7 @@ class ProcessCategory
|
|||||||
public function updateCategory($cat_uid, $cat_name)
|
public function updateCategory($cat_uid, $cat_name)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
require_once 'classes/model/ProcessCategory.php';
|
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "ProcessCategory.php");
|
||||||
$catUID = $cat_uid;
|
$catUID = $cat_uid;
|
||||||
$catName = trim( $cat_name );
|
$catName = trim( $cat_name );
|
||||||
if ($this->existsName( $cat_name )) {
|
if ($this->existsName( $cat_name )) {
|
||||||
|
|||||||
@@ -177,14 +177,12 @@ class InputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
|||||||
* Test error for incorrect value of input document in array
|
* Test error for incorrect value of input document in array
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::removeInputDocument
|
* @covers \ProcessMaker\BusinessModel\Cases\InputDocument::removeInputDocument
|
||||||
* @depends testAddInputDocument
|
|
||||||
* @param array $aResponse
|
|
||||||
* @expectedException Exception
|
* @expectedException Exception
|
||||||
* @expectedExceptionMessage This input document with id: 12345678912345678912345678912345678 doesn't exist!
|
* @expectedExceptionMessage This input document with id: 12345678912345678912345678912345678 doesn't exist!
|
||||||
*
|
*
|
||||||
* @copyright Colosa - Bolivia
|
* @copyright Colosa - Bolivia
|
||||||
*/
|
*/
|
||||||
public function testGetCasesInputDocumentErrorIncorrectApplicationValueArray(array $aResponse)
|
public function testRemoveInputDocumentErrorIncorrectApplicationValueArray()
|
||||||
{
|
{
|
||||||
$this->oInputDocument->removeInputDocument('12345678912345678912345678912345678');
|
$this->oInputDocument->removeInputDocument('12345678912345678912345678912345678');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,20 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
|||||||
return $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
|
* Test get OutputDocuments
|
||||||
*
|
*
|
||||||
@@ -116,6 +130,38 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(is_array($response));
|
$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
|
* Test get OutputDocument
|
||||||
*
|
*
|
||||||
@@ -131,6 +177,20 @@ class OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(is_object($response));
|
$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
|
* Test remove OutputDocument
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,6 +40,20 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test error for incorrect value of category name in array
|
||||||
|
*
|
||||||
|
* @covers \BusinessModel\ProcessCategory::addCategory
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage cat_name. Process Category name can't be null
|
||||||
|
*
|
||||||
|
* @copyright Colosa - Bolivia
|
||||||
|
*/
|
||||||
|
public function testAddCategoryErrorIncorrectValue()
|
||||||
|
{
|
||||||
|
$this->oCategory->addCategory('');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add Category
|
* Test add Category
|
||||||
*
|
*
|
||||||
@@ -55,6 +69,34 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
return $aResponse;
|
return $aResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test error for incorrect value of category name in array
|
||||||
|
*
|
||||||
|
* @covers \BusinessModel\ProcessCategory::addCategory
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage cat_name. Duplicate Process Category name
|
||||||
|
*
|
||||||
|
* @copyright Colosa - Bolivia
|
||||||
|
*/
|
||||||
|
public function testAddCategoryErrorDuplicateValue()
|
||||||
|
{
|
||||||
|
$this->oCategory->addCategory('New Category Test');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test error for incorrect value of category name in array
|
||||||
|
*
|
||||||
|
* @covers \BusinessModel\ProcessCategory::updateCategory
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage cat_name. Duplicate Process Category name
|
||||||
|
*
|
||||||
|
* @copyright Colosa - Bolivia
|
||||||
|
*/
|
||||||
|
public function testUpdateCategoryErrorDuplicateValue()
|
||||||
|
{
|
||||||
|
$this->oCategory->addCategory('New Category Test');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put Category
|
* Test put Category
|
||||||
*
|
*
|
||||||
@@ -70,6 +112,20 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(is_object($response));
|
$this->assertTrue(is_object($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test error for incorrect value of category id
|
||||||
|
*
|
||||||
|
* @covers \BusinessModel\ProcessCategory::getCategory
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage The Category with cat_uid: 12345678912345678912345678912345678 doesn't exist!
|
||||||
|
*
|
||||||
|
* @copyright Colosa - Bolivia
|
||||||
|
*/
|
||||||
|
public function testGetErrorValue()
|
||||||
|
{
|
||||||
|
$this->oCategory->getCategory('12345678912345678912345678912345678');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test get Category
|
* Test get Category
|
||||||
*
|
*
|
||||||
@@ -85,6 +141,19 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(is_object($response));
|
$this->assertTrue(is_object($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test error for incorrect value of category id
|
||||||
|
*
|
||||||
|
* @covers \BusinessModel\ProcessCategory::deleteCategory
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage The Category with cat_uid: 12345678912345678912345678912345678 doesn't exist!
|
||||||
|
*
|
||||||
|
* @copyright Colosa - Bolivia
|
||||||
|
*/
|
||||||
|
public function testDeleteErrorValue()
|
||||||
|
{
|
||||||
|
$this->oCategory->deleteCategory('12345678912345678912345678912345678');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete Category
|
* Test delete Category
|
||||||
|
|||||||
Reference in New Issue
Block a user