Se agrega PHPUNIT para cases OutputDocuments. Se modifican nombres de variables en cases OutputDocuments y CasesTest
This commit is contained in:
@@ -51,7 +51,7 @@ class OutputDocument
|
||||
* @param string $userUid
|
||||
* @param string $applicationDocumentUid
|
||||
*
|
||||
* return array Return an array with data of an OutputDocument
|
||||
* return object Return an object with data of an OutputDocument
|
||||
*/
|
||||
public function getCasesOutputDocument($applicationUid, $userUid, $applicationDocumentUid)
|
||||
{
|
||||
@@ -84,7 +84,8 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
$oResponse = json_decode(json_encode($result), false);
|
||||
return $oResponse;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -95,7 +96,6 @@ class OutputDocument
|
||||
*
|
||||
* @param string $applicationDocumentUid
|
||||
*
|
||||
* return array Return an array with data of an OutputDocument
|
||||
*/
|
||||
public function removeOutputDocument($applicationDocumentUid)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ class OutputDocument
|
||||
* @param string $outputDocumentUid
|
||||
* @param string $userUid
|
||||
*
|
||||
* return array Return an array with data of an OutputDocument
|
||||
* return object Return an object with data of an OutputDocument
|
||||
*/
|
||||
public function addCasesOutputDocument($applicationUid, $outputDocumentUid, $userUid)
|
||||
{
|
||||
@@ -278,7 +278,6 @@ class OutputDocument
|
||||
* @param string $sPath
|
||||
* @return variant
|
||||
*/
|
||||
|
||||
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array(), $sApplication)
|
||||
{
|
||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||
@@ -429,6 +428,14 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate Html2ps_pdf
|
||||
* @param string $sUID
|
||||
* @param array $aFields
|
||||
* @param string $sPath
|
||||
* @param string $sApplication
|
||||
* @return variant
|
||||
*/
|
||||
public function generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array(), $sApplication)
|
||||
{
|
||||
define("MAX_FREE_FRACTION", 1);
|
||||
|
||||
@@ -440,7 +440,7 @@ class CasesTest extends \PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @covers \BusinessModel\Cases::getTaskCase
|
||||
* @depends testAddCase
|
||||
* @param array $aResponse, Data for parent department
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?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 OutputDocumentsCasesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $oOutputDocument;
|
||||
protected $idCase = '';
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oOutputDocument = new \BusinessModel\Cases\OutputDocument();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add OutputDocument
|
||||
*
|
||||
* @covers \BusinessModel\Cases\OutputDocument::addCasesOutputDocument
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCasesOutputDocument()
|
||||
{
|
||||
\G::loadClass('pmFunctions');
|
||||
$usrUid = '00000000000000000000000000000001';
|
||||
$proUid = '1265557095225ff5c688f46031700471';
|
||||
$tasUid = '1352844695225ff5fe54de2005407079';
|
||||
$idCase = PMFNewCase($proUid, $usrUid, $tasUid, array());
|
||||
$response = $this->oOutputDocument->addCasesOutputDocument($idCase, '10401087752fa8bc6f0cab6048419434', '00000000000000000000000000000001');
|
||||
$this->assertTrue(is_object($response));
|
||||
$aResponse = json_decode(json_encode($response), true);
|
||||
$aResponse = array_merge(array("idCase" => $idCase), $aResponse);
|
||||
return $aResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get OutputDocuments
|
||||
*
|
||||
* @covers \BusinessModel\Cases\OutputDocument::getCasesOutputDocuments
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesOutputDocuments(array $aResponse)
|
||||
{
|
||||
$response = $this->oOutputDocument->getCasesOutputDocuments($aResponse["idCase"], '00000000000000000000000000000001');
|
||||
$this->assertTrue(is_array($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get OutputDocument
|
||||
*
|
||||
* @covers \BusinessModel\Cases\OutputDocument::getCasesOutputDocument
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCasesOutputDocument(array $aResponse)
|
||||
{
|
||||
$response = $this->oOutputDocument->getCasesOutputDocument($aResponse["idCase"], '00000000000000000000000000000001', $aResponse["app_doc_uid"]);
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test remove OutputDocument
|
||||
*
|
||||
* @covers \BusinessModel\Cases\OutputDocument::removeOutputDocument
|
||||
* @depends testAddCasesOutputDocument
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
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