PMCORE-2381
This commit is contained in:
@@ -103,13 +103,30 @@ class AbstractCasesTest extends TestCase
|
||||
public function it_return_set_get_priority()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$arguments = [1 => 'VL', 2 => 'L', 3 => 'N', 4 => 'H', 5 => 'VH'];
|
||||
$arguments = ['ALL', 'VL', 'L', 'N', 'H', 'VH'];
|
||||
$index = array_rand($arguments);
|
||||
$absCases->setPriority($index);
|
||||
$absCases->setPriority($arguments[$index]);
|
||||
$actual = $absCases->getPriority();
|
||||
$this->assertEquals($index, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* This check the getter and setter related to the priorities
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setPriorities()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getPriorities()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_set_get_priorities()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$arguments = ['ALL', 'VL', 'L', 'N', 'H', 'VH'];
|
||||
$index = array_rand($arguments);
|
||||
$absCases->setPriorities([$arguments[$index]]);
|
||||
$actual = $absCases->getPriorities();
|
||||
$this->assertEquals([$index], $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* This check the getter and setter related to the case number
|
||||
*
|
||||
@@ -129,9 +146,8 @@ class AbstractCasesTest extends TestCase
|
||||
/**
|
||||
* This check the getter and setter related to the range of case number
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setRangeCaseNumber()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFromCaseNumber()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getToCaseNumber()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseNumberFrom()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseNumberTo()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_set_get_range_case_number()
|
||||
@@ -141,9 +157,10 @@ class AbstractCasesTest extends TestCase
|
||||
'APP_NUMBER' => $case1->APP_NUMBER + 1
|
||||
]);
|
||||
$absCases = new AbstractCases();
|
||||
$absCases->setRangeCaseNumber($case1->APP_NUMBER, $case2->APP_NUMBER);
|
||||
$from = $absCases->getFromCaseNumber();
|
||||
$to = $absCases->getToCaseNumber();
|
||||
$absCases->setCaseNumberFrom($case1->APP_NUMBER);
|
||||
$absCases->setCaseNumberTo($case2->APP_NUMBER);
|
||||
$from = $absCases->getCaseNumberFrom();
|
||||
$to = $absCases->getCaseNumberTo();
|
||||
$this->assertEquals($case1->APP_NUMBER, $from);
|
||||
$this->assertEquals($case2->APP_NUMBER, $to);
|
||||
}
|
||||
@@ -174,12 +191,12 @@ class AbstractCasesTest extends TestCase
|
||||
public function it_return_set_get_inbox_status()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$arguments = ['', 'ALL', 'READ', 'UNREAD'];
|
||||
$arguments = ['ALL', 'READ', 'UNREAD'];
|
||||
$index = array_rand($arguments);
|
||||
$absCases->setInboxStatus($arguments[$index]);
|
||||
$actual = $absCases->getInboxStatus();
|
||||
if (empty($arguments[$index])) {
|
||||
$this->assertEquals('ALL', $actual);
|
||||
if ($arguments[$index] === 'ALL') {
|
||||
$this->assertEmpty($actual);
|
||||
} else {
|
||||
$this->assertEquals($arguments[$index], $actual);
|
||||
}
|
||||
@@ -195,12 +212,12 @@ class AbstractCasesTest extends TestCase
|
||||
public function it_return_set_get_participated_status()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$arguments = ['', 'ALL', 'STARTED', 'COMPLETED'];
|
||||
$arguments = ['ALL', 'STARTED', 'COMPLETED'];
|
||||
$index = array_rand($arguments);
|
||||
$absCases->setParticipatedStatus($arguments[$index]);
|
||||
$actual = $absCases->getParticipatedStatus();
|
||||
if (empty($arguments[$index])) {
|
||||
$this->assertEquals('ALL', $actual);
|
||||
if ($arguments[$index] === 'ALL') {
|
||||
$this->assertEmpty($actual);
|
||||
} else {
|
||||
$this->assertEquals($arguments[$index], $actual);
|
||||
}
|
||||
@@ -216,12 +233,12 @@ class AbstractCasesTest extends TestCase
|
||||
public function it_return_set_get_risk_status()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$arguments = ['', 'ALL', 'ON_TIME', 'AT_RISK', 'OVERDUE'];
|
||||
$arguments = ['ALL', 'ON_TIME', 'AT_RISK', 'OVERDUE'];
|
||||
$index = array_rand($arguments);
|
||||
$absCases->setRiskStatus($arguments[$index]);
|
||||
$actual = $absCases->getRiskStatus();
|
||||
if (empty($arguments[$index])) {
|
||||
$this->assertEquals('ALL', $actual);
|
||||
if ($arguments[$index] === 'ALL') {
|
||||
$this->assertEmpty($actual);
|
||||
} else {
|
||||
$this->assertEquals($arguments[$index], $actual);
|
||||
}
|
||||
@@ -237,18 +254,36 @@ class AbstractCasesTest extends TestCase
|
||||
public function it_return_set_get_case_status()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$arguments = ['', 'ALL', 'DRAFT', 'TO_DO', 'COMPLETED', 'CANCELLED', 'CANCELED'];
|
||||
$arguments = ['ALL', 'DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
|
||||
$index = array_rand($arguments);
|
||||
$absCases->setCaseStatus($arguments[$index]);
|
||||
$actual = $absCases->getCaseStatus();
|
||||
if (empty($arguments[$index])) {
|
||||
$this->assertEquals('ALL', $actual);
|
||||
$this->assertEquals($index, $actual);
|
||||
if ($arguments[$index] === 'ALL') {
|
||||
$this->assertEquals(0, $actual);
|
||||
} else {
|
||||
if ($arguments[$index] === AbstractCases::INCORRECT_CANCELED_STATUS) {
|
||||
$this->assertEquals(AbstractCases::CORRECT_CANCELED_STATUS, $actual);
|
||||
} else {
|
||||
$this->assertEquals($arguments[$index], $actual);
|
||||
}
|
||||
$this->assertEquals($index, $actual);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This check the getter and setter related to the case statuses
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseStatuses()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseStatuses()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_set_get_case_statuses()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$arguments = ['ALL', 'DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
|
||||
$index = array_rand($arguments);
|
||||
$absCases->setCaseStatuses([$arguments[$index]]);
|
||||
$actual = $absCases->getCaseStatuses();
|
||||
if ($arguments[$index] === 'ALL') {
|
||||
$this->assertEquals([], $actual);
|
||||
} else {
|
||||
$this->assertEquals([$index], $actual);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,32 +321,32 @@ class AbstractCasesTest extends TestCase
|
||||
/**
|
||||
* This check the getter and setter related to the newest than date
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setNewestThan()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getNewestThan()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setDelegateFrom()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDelegateFrom()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_set_get_newest_than()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$text = date('Y-m-d');
|
||||
$absCases->setNewestThan($text);
|
||||
$actual = $absCases->getNewestThan();
|
||||
$absCases->setDelegateFrom($text);
|
||||
$actual = $absCases->getDelegateFrom();
|
||||
$this->assertEquals($text, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* This check the getter and setter related to the oldest than date
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setOldestThan()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getOldestThan()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setDelegateTo()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDelegateTo()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_set_get_oldest_than()
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$text = date('Y-m-d');
|
||||
$absCases->setOldestThan($text);
|
||||
$actual = $absCases->getOldestThan();
|
||||
$absCases->setDelegateTo($text);
|
||||
$actual = $absCases->getDelegateTo();
|
||||
$this->assertEquals($text, $actual);
|
||||
}
|
||||
|
||||
@@ -383,52 +418,61 @@ class AbstractCasesTest extends TestCase
|
||||
{
|
||||
$absCases = new AbstractCases();
|
||||
$properties = [
|
||||
'category' => G::generateUniqueID(),
|
||||
// Tasks - Cases
|
||||
'process' => rand(),
|
||||
'task' => rand(),
|
||||
'user' => rand(),
|
||||
'priority' => 1,
|
||||
'caseNumber' => rand(),
|
||||
'caseNumberFrom' => rand(),
|
||||
'caseNumberTo' => rand(),
|
||||
'caseTitle' => G::generateUniqueID(),
|
||||
// Home - Search
|
||||
'priorities' => ['N'],
|
||||
'caseStatuses' => ['TO_DO','DRAFT'],
|
||||
'filterCases'=> '1,3-5,8,10-15',
|
||||
'delegationDateFrom' => date('Y-m-d'),
|
||||
'delegationDateTo' => date('Y-m-d'),
|
||||
// Home - My cases
|
||||
'filter'=> 'ALL',
|
||||
'caseStatus' => 'TO_DO',
|
||||
'startCaseFrom' => date('Y-m-d'),
|
||||
'startCaseTo' => date('Y-m-d'),
|
||||
'finishCaseFrom' => date('Y-m-d'),
|
||||
'finishCaseTo' => date('Y-m-d'),
|
||||
// Other
|
||||
'search' => G::generateUniqueID(),
|
||||
'category' => G::generateUniqueID(),
|
||||
'caseLink' => G::generateUniqueID(),
|
||||
'appUidCheck' => [G::generateUniqueID()],
|
||||
'newestthan' => date('Y-m-d'),
|
||||
'oldestthan' => date('Y-m-d'),
|
||||
'sort' => 'APP_DELEGATION.APP_NUMBER',
|
||||
'sort' => 'APP_NUMBER',
|
||||
'dir' => 'DESC',
|
||||
'paged' => true,
|
||||
'start' => 5,
|
||||
'limit' => 10,
|
||||
];
|
||||
$absCases->setProperties($properties);
|
||||
$actual = $absCases->getCategoryUid();
|
||||
$this->assertEquals($properties['category'], $actual);
|
||||
// Tasks - Cases
|
||||
$actual = $absCases->getProcessId();
|
||||
$this->assertEquals($properties['process'], $actual);
|
||||
$actual = $absCases->getTaskId();
|
||||
$this->assertEquals($properties['task'], $actual);
|
||||
$actual = $absCases->getUserId();
|
||||
$this->assertEquals($properties['user'], $actual);
|
||||
$actual = $absCases->getPriority();
|
||||
$this->assertEquals($properties['priority'], $actual);
|
||||
$actual = $absCases->getCaseNumber();
|
||||
$this->assertEquals($properties['caseNumber'], $actual);
|
||||
$actual = $absCases->getFromCaseNumber();
|
||||
$this->assertEquals($properties['caseNumberFrom'], $actual);
|
||||
$actual = $absCases->getToCaseNumber();
|
||||
$this->assertEquals($properties['caseNumberTo'], $actual);
|
||||
// Home - Search
|
||||
$actual = $absCases->getPriorities();
|
||||
$this->assertNotEmpty($actual);
|
||||
// Home - My cases
|
||||
$actual = $absCases->getParticipatedStatus();
|
||||
$this->assertEmpty($actual);
|
||||
// Other
|
||||
$actual = $absCases->getValueToSearch();
|
||||
$this->assertEquals($properties['search'], $actual);
|
||||
$actual = $absCases->getCategoryUid();
|
||||
$this->assertEquals($properties['category'], $actual);
|
||||
$actual = $absCases->getCaseUid();
|
||||
$this->assertEquals($properties['caseLink'], $actual);
|
||||
$actual = $absCases->getCasesUids();
|
||||
$this->assertEquals($properties['appUidCheck'], $actual);
|
||||
$actual = $absCases->getNewestThan();
|
||||
$this->assertEquals($properties['newestthan'], $actual);
|
||||
$actual = $absCases->getOldestThan();
|
||||
$this->assertEquals($properties['oldestthan'], $actual);
|
||||
$actual = $absCases->getOrderByColumn();
|
||||
$this->assertEquals($properties['sort'], $actual);
|
||||
$actual = $absCases->getOrderDirection();
|
||||
|
||||
@@ -18,6 +18,15 @@ class DraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Method set up.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks the counters is working properly in draft
|
||||
*
|
||||
@@ -93,7 +102,7 @@ class DraftTest extends TestCase
|
||||
// Get first page
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$draft->setOrderByColumn('APP_NUMBER');
|
||||
$draft->setOffset(0);
|
||||
$draft->setLimit(25);
|
||||
$results = $draft->getData();
|
||||
@@ -143,7 +152,7 @@ class DraftTest extends TestCase
|
||||
//Get the data ordered by APP_NUMBER
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$draft->setOrderByColumn('APP_NUMBER');
|
||||
// Get first page, the minor case id
|
||||
$draft->setOrderDirection('ASC');
|
||||
$results = $draft->getData();
|
||||
@@ -359,7 +368,7 @@ class DraftTest extends TestCase
|
||||
// Get first page
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$draft->setOrderByColumn('APP_NUMBER');
|
||||
// Get first page, the specific case
|
||||
$draft->setOrderDirection('ASC');
|
||||
$draft->setCaseUid($application->APP_UID);
|
||||
@@ -394,7 +403,7 @@ class DraftTest extends TestCase
|
||||
// Get first page
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$draft->setOrderByColumn('APP_NUMBER');
|
||||
// Get first page, the specific case
|
||||
$draft->setOrderDirection('ASC');
|
||||
$draft->setCasesUids([$application->APP_UID]);
|
||||
@@ -431,7 +440,7 @@ class DraftTest extends TestCase
|
||||
// Get first page
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$draft->setOrderByColumn('APP_NUMBER');
|
||||
$draft->setProcessId($process->PRO_ID);
|
||||
// Get first page, the minor case title
|
||||
$draft->setOrderDirection('ASC');
|
||||
|
||||
@@ -52,82 +52,13 @@ class InboxTest extends TestCase
|
||||
//Set the user ID
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
//Set OrderBYColumn value
|
||||
$inbox->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
//Call to getData method
|
||||
$res = $inbox->getData();
|
||||
//This assert that the expected numbers of results are returned
|
||||
$this->assertEquals(10, count($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with Risk Filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @test
|
||||
*/
|
||||
public function it_it_should_test_get_data_method_with_Risk_Filter()
|
||||
{
|
||||
//Create process
|
||||
$process = factory(Process::class)->create();
|
||||
|
||||
//Create user
|
||||
$user = factory(User::class)->create();
|
||||
|
||||
//Create a task
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => '',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
]);
|
||||
|
||||
//Create the register in delegation
|
||||
factory(Delegation::class, 10)->create([
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'DEL_RISK_DATE' => '2019-06-07 12:30:58'
|
||||
]);
|
||||
|
||||
//Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
|
||||
//Set the user UID
|
||||
$inbox->setUserUid($user->USR_UID);
|
||||
|
||||
//Set the user ID
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
|
||||
//Set OrderBYColumn value
|
||||
$inbox->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
|
||||
//Set setRiskStatus value
|
||||
$inbox->setRiskStatus('ON_TIME');
|
||||
$res = $inbox->getData();
|
||||
|
||||
//This asserts that no cases are in ON_TIME status
|
||||
$this->assertEmpty($res);
|
||||
|
||||
//Set setRiskStatus value
|
||||
$inbox->setRiskStatus('OVERDUE');
|
||||
|
||||
//Call to getData method
|
||||
$res = $inbox->getData();
|
||||
|
||||
//This asserts that there are cases in AT_RISK status
|
||||
$this->assertNotEmpty($res);
|
||||
|
||||
//Set setRiskStatus value
|
||||
$inbox->setRiskStatus('AT_RISK');
|
||||
|
||||
//Call to getData method
|
||||
$res = $inbox->getData();
|
||||
|
||||
//This asserts that no cases are in AT_RISK status
|
||||
$this->assertEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with Category Filter
|
||||
*
|
||||
@@ -169,7 +100,7 @@ class InboxTest extends TestCase
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
|
||||
//Set OrderBYColumn value
|
||||
$inbox->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
|
||||
//Set Category value
|
||||
$inbox->setCategoryUid('248565910552bd7d6006458065223611');
|
||||
@@ -213,7 +144,7 @@ class InboxTest extends TestCase
|
||||
$inbox = new Inbox();
|
||||
$inbox->setUserUid($user->USR_UID);
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
$inbox->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
$inbox->setProcessId($process[1]->PRO_ID);
|
||||
$res = $inbox->getData();
|
||||
$this->assertEmpty($res);
|
||||
@@ -254,13 +185,13 @@ class InboxTest extends TestCase
|
||||
$inbox = new Inbox();
|
||||
$inbox->setUserUid($user->USR_UID);
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
$inbox->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
$inbox->setOrderDirection('DESC');
|
||||
$res = $inbox->getData();
|
||||
// This asserts the order is for APP_NUMBER from highest to lowest
|
||||
$this->assertLessThan($res[0]['APP_NUMBER'], $res[1]['APP_NUMBER']);
|
||||
|
||||
$inbox->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
$inbox->setOrderDirection('ASC');
|
||||
$res = $inbox->getData();
|
||||
// This asserts the order is for APP_NUMBER from highest to lowest
|
||||
@@ -552,7 +483,7 @@ class InboxTest extends TestCase
|
||||
$inbox = new Inbox();
|
||||
$inbox->setUserUid($user->USR_UID);
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
$inbox->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
$inbox->setOffset(5);
|
||||
$inbox->setLimit(2);
|
||||
$res = $inbox->getData();
|
||||
|
||||
@@ -60,7 +60,7 @@ class ParticipatedTest extends TestCase
|
||||
// Set the user ID
|
||||
$participated->setUserId($cases->USR_ID);
|
||||
// Set OrderBYColumn value
|
||||
$participated->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$participated->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $participated->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
@@ -86,7 +86,7 @@ class ParticipatedTest extends TestCase
|
||||
// Set the process ID
|
||||
$participated->setProcessId($cases->PRO_ID);
|
||||
// Set OrderBYColumn value
|
||||
$participated->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$participated->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $participated->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
@@ -116,7 +116,7 @@ class ParticipatedTest extends TestCase
|
||||
// Set the category
|
||||
$participated->setCategoryUid($process['PRO_CATEGORY']);
|
||||
// Set OrderBYColumn value
|
||||
$participated->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$participated->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $participated->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
@@ -142,7 +142,7 @@ class ParticipatedTest extends TestCase
|
||||
// Set the case status
|
||||
$participated->setCaseStatus('TO_DO');
|
||||
// Set OrderBYColumn value
|
||||
$participated->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$participated->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $participated->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
@@ -168,7 +168,7 @@ class ParticipatedTest extends TestCase
|
||||
// Set the filter STARTED
|
||||
$participated->setParticipatedStatus('STARTED');
|
||||
// Set OrderBYColumn value
|
||||
$participated->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$participated->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $participated->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
@@ -194,7 +194,7 @@ class ParticipatedTest extends TestCase
|
||||
// Set the filter COMPLETED
|
||||
$participated->setParticipatedStatus('COMPLETED');
|
||||
// Set OrderBYColumn value
|
||||
$participated->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$participated->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $participated->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
|
||||
@@ -470,7 +470,7 @@ class PausedTest extends TestCase
|
||||
$paused->setUserId($user->USR_ID);
|
||||
|
||||
//Set OrderBYColumn value
|
||||
$paused->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$paused->setOrderByColumn('APP_NUMBER');
|
||||
|
||||
//Set Order Direction value
|
||||
$paused->setOrderDirection('DESC');
|
||||
@@ -598,7 +598,7 @@ class PausedTest extends TestCase
|
||||
$paused->setUserId($user->USR_ID);
|
||||
|
||||
//Set OrderBYColumn value
|
||||
$paused->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$paused->setOrderByColumn('APP_NUMBER');
|
||||
|
||||
//Set offset and limit values
|
||||
$paused->setOffset(0);
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\BusinessModel\Cases\Reassign;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Reassign
|
||||
*/
|
||||
class ReassignTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* It tests the getData method without filters
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Reassign::getData()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_data_method_without_filters()
|
||||
{
|
||||
$cases = 25;
|
||||
factory(Delegation::class, $cases)->states('foreign_keys')->create();
|
||||
//Create new Reassign object
|
||||
$reassign = new Reassign();
|
||||
//Set OrderBYColumn value
|
||||
$reassign->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
//Call to getData method
|
||||
$res = $reassign->getData();
|
||||
//This assert that the expected numbers of results are returned
|
||||
$this->assertEquals($cases, count($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with user filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Reassign::getData()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_data_method_with_user_filter()
|
||||
{
|
||||
// Create user
|
||||
$user = factory(User::class)->create();
|
||||
// Create delegation related to the specific user
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
]);
|
||||
// Create other delegations
|
||||
$cases = 5;
|
||||
factory(Delegation::class, $cases)->states('foreign_keys')->create();
|
||||
//Create new Reassign object
|
||||
$reassign = new Reassign();
|
||||
//Set the user UID
|
||||
$reassign->setUserUid($user->USR_UID);
|
||||
//Set the user ID
|
||||
$reassign->setUserId($user->USR_ID);
|
||||
//Set OrderBYColumn value
|
||||
$reassign->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
//Call to getData method
|
||||
$res = $reassign->getData();
|
||||
//This assert that the expected numbers of results are returned
|
||||
$this->assertEquals(1, count($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with process filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Reassign::getData()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_data_method_with_process_filter()
|
||||
{
|
||||
// Create user
|
||||
$process = factory(Process::class)->create();
|
||||
// Create delegation related to the specific user
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
]);
|
||||
// Create other delegations
|
||||
$cases = 5;
|
||||
factory(Delegation::class, $cases)->states('foreign_keys')->create();
|
||||
//Create new Reassign object
|
||||
$reassign = new Reassign();
|
||||
//Set the process
|
||||
$reassign->setProcessId($process->PRO_ID);
|
||||
$reassign->setProcessUid($process->PRO_UID);
|
||||
//Set OrderBYColumn value
|
||||
$reassign->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
//Call to getData method
|
||||
$res = $reassign->getData();
|
||||
//This assert that the expected numbers of results are returned
|
||||
$this->assertEquals(1, count($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCounter method
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Reassign::getCounter()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_the_counter_for_reassign()
|
||||
{
|
||||
// Create user
|
||||
$user = factory(User::class)->create();
|
||||
$cases = 25;
|
||||
factory(Delegation::class, $cases)->states('foreign_keys')->create([
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
]);
|
||||
//Create the Inbox object
|
||||
$reassign = new Reassign();
|
||||
//Set the user UID
|
||||
$reassign->setUserUid($user->USR_UID);
|
||||
//Set the user ID
|
||||
$reassign->setUserId($user->USR_ID);
|
||||
$res = $reassign->getCounter();
|
||||
//Assert the result of getCounter method
|
||||
$this->assertEquals($cases, $res);
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class SearchTest extends TestCase
|
||||
$search = new Search();
|
||||
$search->setCaseNumber($cases[0]->APP_NUMBER);
|
||||
// Set order by column value
|
||||
$search->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$search->setOrderByColumn('APP_NUMBER');
|
||||
$result = $search->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
|
||||
@@ -88,9 +88,9 @@ class SearchTest extends TestCase
|
||||
$cases = $this->createSearch();
|
||||
// Create new Search object
|
||||
$search = new Search();
|
||||
$search->setPriority($cases[0]->DEL_PRIORITY);
|
||||
$search->setPriority('N');
|
||||
// Set order by column value
|
||||
$search->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$search->setOrderByColumn('APP_NUMBER');
|
||||
$result = $search->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertNotEmpty($result);
|
||||
@@ -110,7 +110,7 @@ class SearchTest extends TestCase
|
||||
$search = new Search();
|
||||
$search->setProcessId($cases[0]->PRO_ID);
|
||||
// Set order by column value
|
||||
$search->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$search->setOrderByColumn('APP_NUMBER');
|
||||
$result = $search->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertNotEmpty($result);
|
||||
@@ -130,7 +130,7 @@ class SearchTest extends TestCase
|
||||
$search = new Search();
|
||||
$search->setTaskId($cases[0]->TAS_ID);
|
||||
// Set order by column value
|
||||
$search->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$search->setOrderByColumn('APP_NUMBER');
|
||||
$result = $search->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertNotEmpty($result);
|
||||
@@ -150,7 +150,7 @@ class SearchTest extends TestCase
|
||||
$search = new Search();
|
||||
$search->setUserId($cases[0]->USR_ID);
|
||||
// Set order by column value
|
||||
$search->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$search->setOrderByColumn('APP_NUMBER');
|
||||
$result = $search->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertNotEmpty($result);
|
||||
@@ -169,7 +169,7 @@ class SearchTest extends TestCase
|
||||
// Create new Search object
|
||||
$search = new Search();
|
||||
// Set order by column value
|
||||
$search->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$search->setOrderByColumn('APP_NUMBER');
|
||||
$total = $search->getCounter();
|
||||
$this->assertEquals(count($cases), $total);
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ class UnassignedTest extends TestCase
|
||||
// Get first page
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$unassigned->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$unassigned->setOrderByColumn('APP_NUMBER');
|
||||
$unassigned->setOrderDirection('DESC');
|
||||
$unassigned->setOffset(0);
|
||||
$unassigned->setLimit(25);
|
||||
@@ -600,7 +600,7 @@ class UnassignedTest extends TestCase
|
||||
// Get first page
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$unassigned->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$unassigned->setOrderByColumn('APP_NUMBER');
|
||||
$unassigned->setOrderDirection('DESC');
|
||||
$unassigned->setOffset(0);
|
||||
$unassigned->setLimit(25);
|
||||
@@ -688,7 +688,7 @@ class UnassignedTest extends TestCase
|
||||
// Get first page
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$unassigned->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$unassigned->setOrderByColumn('APP_NUMBER');
|
||||
$unassigned->setOrderDirection('DESC');
|
||||
$unassigned->setOffset(0);
|
||||
$unassigned->setLimit(25);
|
||||
@@ -787,7 +787,7 @@ class UnassignedTest extends TestCase
|
||||
// Get first page
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$unassigned->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$unassigned->setOrderByColumn('APP_NUMBER');
|
||||
$unassigned->setOrderDirection('DESC');
|
||||
$unassigned->setOffset(0);
|
||||
$unassigned->setLimit(25);
|
||||
@@ -856,7 +856,7 @@ class UnassignedTest extends TestCase
|
||||
// Get first page, the minor case id
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$unassigned->setOrderByColumn('APP_DELEGATION.APP_NUMBER');
|
||||
$unassigned->setOrderByColumn('APP_NUMBER');
|
||||
$unassigned->setOrderDirection('ASC');
|
||||
$unassigned->setOffset(0);
|
||||
$unassigned->setLimit(25);
|
||||
@@ -1207,7 +1207,7 @@ class UnassignedTest extends TestCase
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$dateToFilter = date('Y-m-d', strtotime('+1 year'));
|
||||
$unassigned->setNewestThan($dateToFilter);
|
||||
$unassigned->setDelegateFrom($dateToFilter);
|
||||
$unassigned->setOrderByColumn('DEL_DELEGATE_DATE');
|
||||
$unassigned->setOrderDirection('ASC');
|
||||
$unassigned->setOffset(0);
|
||||
@@ -1216,7 +1216,7 @@ class UnassignedTest extends TestCase
|
||||
$results = $unassigned->getData();
|
||||
$this->assertGreaterThan($results[0]['DEL_DELEGATE_DATE'], $results[1]['DEL_DELEGATE_DATE']);
|
||||
// Get the newest than (>=) delegate date
|
||||
$unassigned->setNewestThan($dateToFilter);
|
||||
$unassigned->setDelegateFrom($dateToFilter);
|
||||
$unassigned->setOrderDirection('DESC');
|
||||
$results = $unassigned->getData();
|
||||
$this->assertLessThan($results[0]['DEL_DELEGATE_DATE'], $results[1]['DEL_DELEGATE_DATE']);
|
||||
@@ -1265,7 +1265,7 @@ class UnassignedTest extends TestCase
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$dateToFilter = date('Y-m-d', strtotime('+1 year'));
|
||||
$unassigned->setOldestThan($dateToFilter);
|
||||
$unassigned->setDelegateTo($dateToFilter);
|
||||
$unassigned->setOrderByColumn('DEL_DELEGATE_DATE');
|
||||
$unassigned->setOrderDirection('ASC');
|
||||
$unassigned->setOffset(0);
|
||||
@@ -1329,66 +1329,6 @@ class UnassignedTest extends TestCase
|
||||
$this->assertEquals($application->APP_UID, $results[0]['APP_UID']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures searching specific cases and review the page in self-service-user-assigned
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_search_self_service_user_assigned_specific_cases_uid_array()
|
||||
{
|
||||
//Create user
|
||||
$user = factory(User::class)->create();
|
||||
for ($i = 1; $i <= 2; $i++) {
|
||||
//Create process
|
||||
$process = factory(Process::class)->create();
|
||||
//Create application
|
||||
$application = factory(Application::class)->create([
|
||||
'APP_STATUS_ID' => 2
|
||||
]);
|
||||
//Create a task self service
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
]);
|
||||
//Assign a user in the task
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1, //Related to the user
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
//Create the register in delegation relate to self-service
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_ID' => 0
|
||||
]);
|
||||
}
|
||||
$unassigned = new Unassigned;
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
$unassigned->setCasesUids([$application->APP_UID]);
|
||||
$unassigned->setOrderByColumn('APP_DELEGATION.APP_UID');
|
||||
$unassigned->setOrderDirection('ASC');
|
||||
$unassigned->setOffset(0);
|
||||
$unassigned->setLimit(25);
|
||||
// Get the specific cases uid's
|
||||
$results = $unassigned->getData();
|
||||
$this->assertCount(1, $results);
|
||||
// Get the specific cases uid's
|
||||
$unassigned->setCasesUids([$application->APP_UID]);
|
||||
$results = $unassigned->getData();
|
||||
$this->assertEquals($application->APP_UID, $results[0]['APP_UID']);
|
||||
// Get the specific cases uid's
|
||||
$unassigned->setCasesUids([$application->APP_UID]);
|
||||
$results = $unassigned->getData();
|
||||
$this->assertEquals($application->APP_UID, $results[0]['APP_UID']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures searching specific process and review the page in self-service-user-assigned
|
||||
*
|
||||
|
||||
@@ -81,7 +81,7 @@ class DelegationTest extends TestCase
|
||||
public function it_return_scope_case_in_progress()
|
||||
{
|
||||
$table = factory(Delegation::class)->states('foreign_keys')->create();
|
||||
$this->assertCount(1, $table->caseInProgress()->get());
|
||||
$this->assertCount(1, $table->joinApplication()->caseInProgress()->get());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ class DelegationTest extends TestCase
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'APP_UID' => $application->APP_UID,
|
||||
]);
|
||||
$this->assertCount(1, $table->caseCompleted()->get());
|
||||
$this->assertCount(1, $table->joinApplication()->caseCompleted()->get());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ class DelegationTest extends TestCase
|
||||
public function it_return_scope_delegate_date_to()
|
||||
{
|
||||
$table = factory(Delegation::class)->states('foreign_keys')->create();
|
||||
$this->assertCount(1, $table->delegateDateFrom($table->DEL_DELEGATE_DATE)->get());
|
||||
$this->assertCount(1, $table->delegateDateTo($table->DEL_DELEGATE_DATE)->get());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user