PMCORE-2397

This commit is contained in:
Paula Quispe
2020-12-09 19:04:05 -04:00
parent bb38e8acd8
commit 9565312ca9
20 changed files with 806 additions and 1431 deletions

View File

@@ -103,11 +103,15 @@ class AbstractCasesTest extends TestCase
public function it_return_set_get_priority()
{
$absCases = new AbstractCases();
$arguments = ['VL', 'L', 'N', 'H', 'VH'];
$arguments = ['', 'VL', 'L', 'N', 'H', 'VH'];
$index = array_rand($arguments);
$absCases->setPriority($arguments[$index]);
$actual = $absCases->getPriority();
$this->assertEquals($index, $actual);
// Empty
$absCases->setPriority('');
$actual = $absCases->getPriority();
$this->assertEquals(0, $actual);
}
/**
@@ -120,7 +124,7 @@ class AbstractCasesTest extends TestCase
public function it_return_set_get_priorities()
{
$absCases = new AbstractCases();
$arguments = ['VL', 'L', 'N', 'H', 'VH'];
$arguments = ['', 'VL', 'L', 'N', 'H', 'VH'];
$index = array_rand($arguments);
$absCases->setPriorities([$arguments[$index]]);
$actual = $absCases->getPriorities();
@@ -148,6 +152,8 @@ class AbstractCasesTest extends TestCase
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseNumberFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseNumberTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseNumberFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseNumberTo()
* @test
*/
public function it_return_set_get_range_case_number()
@@ -191,11 +197,11 @@ class AbstractCasesTest extends TestCase
public function it_return_set_get_inbox_status()
{
$absCases = new AbstractCases();
$arguments = ['ALL', 'READ', 'UNREAD'];
$arguments = ['READ', 'UNREAD'];
$index = array_rand($arguments);
$absCases->setInboxStatus($arguments[$index]);
$actual = $absCases->getInboxStatus();
if ($arguments[$index] === 'ALL') {
if ($arguments[$index] === '') {
$this->assertEmpty($actual);
} else {
$this->assertEquals($arguments[$index], $actual);
@@ -212,15 +218,11 @@ class AbstractCasesTest extends TestCase
public function it_return_set_get_participated_status()
{
$absCases = new AbstractCases();
$arguments = ['ALL', 'STARTED', 'COMPLETED'];
$arguments = ['STARTED', 'COMPLETED'];
$index = array_rand($arguments);
$absCases->setParticipatedStatus($arguments[$index]);
$actual = $absCases->getParticipatedStatus();
if ($arguments[$index] === 'ALL') {
$this->assertEmpty($actual);
} else {
$this->assertEquals($arguments[$index], $actual);
}
$this->assertEquals($arguments[$index], $actual);
}
/**
@@ -233,15 +235,11 @@ class AbstractCasesTest extends TestCase
public function it_return_set_get_risk_status()
{
$absCases = new AbstractCases();
$arguments = ['ALL', 'ON_TIME', 'AT_RISK', 'OVERDUE'];
$arguments = ['ON_TIME', 'AT_RISK', 'OVERDUE'];
$index = array_rand($arguments);
$absCases->setRiskStatus($arguments[$index]);
$actual = $absCases->getRiskStatus();
if ($arguments[$index] === 'ALL') {
$this->assertEmpty($actual);
} else {
$this->assertEquals($arguments[$index], $actual);
}
$this->assertEquals($arguments[$index], $actual);
}
/**
@@ -254,16 +252,15 @@ class AbstractCasesTest extends TestCase
public function it_return_set_get_case_status()
{
$absCases = new AbstractCases();
$arguments = ['ALL', 'DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
$arguments = ['', 'DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
$index = array_rand($arguments);
$absCases->setCaseStatus($arguments[$index]);
$actual = $absCases->getCaseStatus();
$this->assertEquals($index, $actual);
if ($arguments[$index] === 'ALL') {
$this->assertEquals(0, $actual);
} else {
$this->assertEquals($index, $actual);
}
// Incorrect canceled status
$absCases->setCaseStatuses(['CANCELLED']);
$actual = $absCases->getCaseStatuses();
$this->assertEquals([4], $actual);
}
/**
@@ -276,11 +273,15 @@ class AbstractCasesTest extends TestCase
public function it_return_set_get_case_statuses()
{
$absCases = new AbstractCases();
$arguments = ['DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
$arguments = ['', 'DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
$index = array_rand($arguments);
$absCases->setCaseStatuses([$arguments[$index]]);
$actual = $absCases->getCaseStatuses();
$this->assertEquals([$index], $actual);
// Incorrect canceled status
$absCases->setCaseStatuses(['CANCELLED']);
$actual = $absCases->getCaseStatuses();
$this->assertEquals([4], $actual);
}
/**
@@ -314,6 +315,62 @@ class AbstractCasesTest extends TestCase
$this->assertEquals([$application->APP_NUMBER], $actual);
}
/**
* This check the getter and setter related to the filter cases
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFilterCases()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFilterCases()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCasesNumbers()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCasesNumbers()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setRangeCasesFromTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getRangeCasesFromTo()
* @test
*/
public function it_return_set_get_filter_cases()
{
$absCases = new AbstractCases();
$text = '1,3-5,8,10-15';
$absCases->setFilterCases($text);
$actual = $absCases->getFilterCases();
$this->assertEquals($text, $actual);
$actual = $absCases->getCasesNumbers();
$this->assertEquals([1,8], $actual);
$actual = $absCases->getRangeCasesFromTo();
$this->assertEquals(['3-5','10-15'], $actual);
}
/**
* This check the getter and setter related to the start case from
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setStartCaseFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getStartCaseFrom()
* @test
*/
public function it_return_set_get_start_case_from()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setStartCaseFrom($text);
$actual = $absCases->getStartCaseFrom();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the start case to
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setStartCaseTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getStartCaseTo()
* @test
*/
public function it_return_set_get_start_case_to()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setStartCaseTo($text);
$actual = $absCases->getStartCaseTo();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the newest than date
*
@@ -321,7 +378,7 @@ class AbstractCasesTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDelegateFrom()
* @test
*/
public function it_return_set_get_newest_than()
public function it_return_set_get_delegation_from()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
@@ -337,7 +394,7 @@ class AbstractCasesTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDelegateTo()
* @test
*/
public function it_return_set_get_oldest_than()
public function it_return_set_get_delegation_to()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
@@ -346,6 +403,102 @@ class AbstractCasesTest extends TestCase
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the finish case from
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFinishCaseFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFinishCaseFrom()
* @test
*/
public function it_return_set_get_finish_case_from()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setFinishCaseFrom($text);
$actual = $absCases->getFinishCaseFrom();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the finish case to
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFinishCaseTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFinishCaseTo()
* @test
*/
public function it_return_set_get_finish_case_to()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setFinishCaseTo($text);
$actual = $absCases->getFinishCaseTo();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the finish delegate from
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFinishFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFinishFrom()
* @test
*/
public function it_return_set_get_finish_delegate_from()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setFinishFrom($text);
$actual = $absCases->getFinishFrom();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the finish delegate to
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFinishTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFinishTo()
* @test
*/
public function it_return_set_get_finish_delegate_to()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setFinishTo($text);
$actual = $absCases->getFinishTo();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the due date from
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setDueFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDueFrom()
* @test
*/
public function it_return_set_get_due_from()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setDueFrom($text);
$actual = $absCases->getDueFrom();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the due date to
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setDueTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDueTo()
* @test
*/
public function it_return_set_get_due_to()
{
$absCases = new AbstractCases();
$text = date('Y-m-d');
$absCases->setDueTo($text);
$actual = $absCases->getDueTo();
$this->assertEquals($text, $actual);
}
/**
* This check the getter and setter related to the oldest than date
*
@@ -436,7 +589,7 @@ class AbstractCasesTest extends TestCase
$actual = $absCases->getPriorities();
$this->assertEmpty($actual);
$actual = $absCases->getCaseStatuses();
$this->assertEmpty($actual);
$this->assertEquals([1,2,3,4], $actual);
$actual = $absCases->getFilterCases();
$this->assertEmpty($actual);
$actual = $absCases->getDelegateFrom();
@@ -465,6 +618,11 @@ class AbstractCasesTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setUserId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseNumber()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseTitle()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getProcessId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getTaskId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getUserId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseNumber()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseTitle()
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setParticipatedStatus()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseStatus()
@@ -472,6 +630,12 @@ class AbstractCasesTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setStartCaseTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFinishCaseFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFinishCaseTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getParticipatedStatus()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseStatus()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getStartCaseFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getStartCaseTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFinishCaseFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFinishCaseTo()
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setFilterCases()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseStatuses()
@@ -480,6 +644,12 @@ class AbstractCasesTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setDelegateTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setDueFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setDueTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getFilterCases()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseStatuses()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDelegateFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDelegateTo()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDueFrom()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getDueTo()
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseUid()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCasesUids()
@@ -488,6 +658,13 @@ class AbstractCasesTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setPaged()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setOffset()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setLimit()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCaseUid()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCasesUids()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getOrderByColumn()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getOrderDirection()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getPaged()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getOffset()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getLimit()
* @test
*/
public function it_return_set_get_properties()
@@ -534,21 +711,23 @@ class AbstractCasesTest extends TestCase
$this->assertEquals($properties['user'], $actual);
$actual = $absCases->getCaseNumber();
$this->assertEquals($properties['caseNumber'], $actual);
$actual = $absCases->getCaseTitle();
$this->assertEquals($properties['caseTitle'], $actual);
// Home - Search
$actual = $absCases->getPriorities();
$this->assertNotEmpty($actual);
$this->assertEmpty($actual);
$actual = $absCases->getCaseStatuses();
$this->assertNotEmpty($actual);
$actual = $absCases->getFilterCases();
$this->assertEquals([1,8], $actual);
$this->assertEmpty($actual);
$actual = $absCases->getCasesNumbers();
$this->assertEquals(['3-5','10-15'], $actual);
$this->assertEmpty($actual);
$actual = $absCases->getRangeCasesFromTo();
$this->assertNotEmpty($actual);
$this->assertEmpty($actual);
$actual = $absCases->getDelegateFrom();
$this->assertEquals($properties['delegationDateFrom'], $actual);
$this->assertEmpty($actual);
$actual = $absCases->getDelegateTo();
$this->assertEquals($properties['delegationDateTo'], $actual);
$this->assertEmpty($actual);
// Home - My cases
$actual = $absCases->getParticipatedStatus();
$this->assertEmpty($actual);
@@ -582,4 +761,36 @@ class AbstractCasesTest extends TestCase
$actual = $absCases->getLimit();
$this->assertEquals($properties['limit'], $actual);
}
/**
* This check the get task color
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getTaskColor()
* @test
*/
public function it_return_task_color()
{
$absCases = new AbstractCases();
$dueDate = date('Y-m-d');
$result = $absCases->getTaskColor($dueDate);
$this->assertNotEmpty($result);
}
/**
* This check task color according the due date
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::prepareTaskPending()
* @test
*/
public function it_return_task_pending_result()
{
$task = factory(Task::class, 2)->create();
$absCases = new AbstractCases();
$pending = '[
{"tas_id":'.$task[0]->TAS_ID.', "user_id":1, "due_date":"2020-12-04 19:11:14"},
{"tas_id":'.$task[1]->TAS_ID.', "user_id":2, "due_date":"2020-12-04 19:12:45"}
]';
$result = $absCases->prepareTaskPending($pending);
$this->assertNotEmpty($result);
}
}

View File

@@ -3,6 +3,7 @@
namespace Tests\unit\workflow\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Draft;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
@@ -65,92 +66,138 @@ class DraftTest extends TestCase
* It tests the getData method without filters
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @test
*/
public function it_should_test_get_data_method_without_filters()
public function it_get_result_without_filters()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$inbox = new Inbox();
$draft = new Inbox();
// Set the user ID
$inbox->setUserId($cases->USR_ID);
$inbox->setOrderByColumn('APP_NUMBER');
$res = $inbox->getData();
$draft->setUserId($cases->USR_ID);
$draft->setOrderByColumn('APP_NUMBER');
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with Process Filter
* It tests the getData method with processId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_should_test_get_data_by_process_filter()
public function it_filter_by_process()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$inbox = new Draft();
$inbox->setUserId($cases->USR_ID);
$inbox->setProcessId($cases->PRO_ID);
$inbox->setOrderByColumn('APP_NUMBER');
$res = $inbox->getData();
$draft = new Draft();
$draft->setUserId($cases->USR_ID);
$draft->setProcessId($cases->PRO_ID);
$draft->setOrderByColumn('APP_NUMBER');
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method using OrderBy
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_should_test_get_data_by_case_number()
public function it_filter_by_app_number()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$inbox = new Draft();
$inbox->setUserId($cases->USR_ID);
$inbox->setCaseNumber($cases->APP_NUMBER);
$inbox->setOrderByColumn('APP_NUMBER');
$res = $inbox->getData();
$draft = new Draft();
$draft->setUserId($cases->USR_ID);
$draft->setCaseNumber($cases->APP_NUMBER);
$draft->setOrderByColumn('APP_NUMBER');
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method using OrderBy
* It tests the getData method with taskId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_should_test_get_data_by_task_filter()
public function it_filter_by_task()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$inbox = new Draft();
$inbox->setUserId($cases->USR_ID);
$inbox->setTaskId($cases->TAS_ID);
$res = $inbox->getData();
$draft = new Draft();
$draft->setUserId($cases->USR_ID);
$draft->setTaskId($cases->TAS_ID);
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method using OrderBy
* It tests the getData method with case title filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_should_test_get_data_by_case_title()
public function it_filter_by_thread_title()
{
// Create factories related to the to_do cases
$cases = $this->createDraft();
$title = $cases->last()->DEL_TITLE;
// We need to commit the records inserted because is needed for the "fulltext" index
DB::commit();
// Create new Draft object
$inbox = new Draft();
$inbox->setUserId($cases->USR_ID);
$res = $inbox->getData();
$draft = new Draft();
$draft->setUserId($cases->USR_ID);
// Set the title
$draft->setCaseTitle($cases->DEL_TITLE);
// Get the data
$res = $draft->getData();
// Asserts
$this->assertNotEmpty($res);
}
/**
* It tests the getData method using order by column
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_order_by_column()
{
// Create factories related to the to_do cases
$cases = $this->createDraft();
$columnsView = [
'APP_NUMBER',
'DEL_TITLE',
'PRO_TITLE',
'TAS_TITLE',
'DEL_TASK_DUE_DATE',
'DEL_DELEGATE_DATE'
];
$index = array_rand($columnsView);
// Create new Inbox object
$draft = new Draft();
$draft->setUserId($cases->USR_ID);
// Define the column to order
$draft->setOrderByColumn($columnsView[$index]);
$res = $draft->getData();
$this->assertNotEmpty($res);
}
}

View File

@@ -3,6 +3,7 @@
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Inbox;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
@@ -36,13 +37,31 @@ class InboxTest extends TestCase
return $delegation;
}
/**
* It tests the getCounter method
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCounter()
* @test
*/
public function it_get_counter()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create the Inbox object
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
$res = $inbox->getCounter();
$this->assertTrue($res > 0);
}
/**
* It tests the getData method without filters
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @test
*/
public function it_should_test_get_data_method_without_filters()
public function it_get_result_without_filters()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
@@ -59,12 +78,14 @@ class InboxTest extends TestCase
}
/**
* It tests the getData method with Process Filter
* It tests the getData method with processId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_should_test_get_data_by_process_filter()
public function it_filter_by_process()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
@@ -78,12 +99,14 @@ class InboxTest extends TestCase
}
/**
* It tests the getData method using OrderBy
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_should_test_get_data_by_case_number()
public function it_filter_by_app_number()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
@@ -97,12 +120,14 @@ class InboxTest extends TestCase
}
/**
* It tests the getData method using OrderBy
* It tests the getData method with taskId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_should_test_get_data_by_task_filter()
public function it_filter_by_task()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
@@ -116,36 +141,57 @@ class InboxTest extends TestCase
}
/**
* It tests the getData method using OrderBy
* It tests the getData method with case title filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_should_test_get_data_by_case_title()
public function it_filter_by_thread_title()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// We need to commit the records inserted because is needed for the "fulltext" index
DB::commit();
// Create new Inbox object
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
// Set the title
$inbox->setCaseTitle($cases->DEL_TITLE);
// Get the data
$res = $inbox->getData();
// Asserts
$this->assertNotEmpty($res);
}
/**
* It tests the getCounter method
* It tests the getData method using order by column
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCounter()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_should_test_the_counter_for_inbox()
public function it_order_by_column()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create the Inbox object
$columnsView = [
'APP_NUMBER',
'DEL_TITLE',
'PRO_TITLE',
'TAS_TITLE',
'DEL_TASK_DUE_DATE',
'DEL_DELEGATE_DATE'
];
$index = array_rand($columnsView);
// Create new Inbox object
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
$res = $inbox->getCounter();
$this->assertTrue($res > 0);
// Define the column to order
$inbox->setOrderByColumn($columnsView[$index]);
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
}

View File

@@ -3,6 +3,7 @@
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Participated;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
@@ -48,9 +49,10 @@ class ParticipatedTest extends TestCase
* It tests the getData method without filters
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @test
*/
public function it_should_test_get_data_method_without_filters()
public function it_get_result_without_filters()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
@@ -68,95 +70,15 @@ class ParticipatedTest extends TestCase
$this->assertEquals(1, count($res));
}
/**
* It tests the getData method with process
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @test
*/
public function it_should_test_get_data_method_with_specific_process()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set the process ID
$participated->setProcessId($cases->PRO_ID);
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(1, count($res));
}
/**
* It tests the getData method with process category
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @test
*/
public function it_should_test_get_data_method_with_specific_process_category()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
$process = Process::query()->where('PRO_ID', $cases->PRO_ID)->get()->toArray();
$process = head($process);
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set the process ID
$participated->setProcessId($cases->PRO_ID);
// Set the category
$participated->setCategoryUid($process['PRO_CATEGORY']);
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(1, count($res));
}
/**
* It tests the getData method with specific TO_DO status
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @test
*/
public function it_should_test_get_data_method_with_case_to_do()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set the case status
$participated->setCaseStatus('TO_DO');
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(1, count($res));
}
/**
* It tests the getData method with specific filter StartedByMe
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @test
*/
public function it_should_test_get_data_method_started_by_me_filter()
public function it_filter_by_started_by_me()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
@@ -173,16 +95,18 @@ class ParticipatedTest extends TestCase
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(0, count($res));
$this->assertEquals(1, count($res));
}
/**
* It tests the getData method with specific filter CompletedByMe
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @test
*/
public function it_should_test_get_data_method_completed_by_me_filter()
public function it_filter_by_completed_by_me()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
@@ -202,13 +126,73 @@ class ParticipatedTest extends TestCase
$this->assertEquals(0, count($res));
}
/**
* It tests the getData method with processId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @test
*/
public function it_filter_by_process()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set the process ID
$participated->setProcessId($cases->PRO_ID);
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(1, count($res));
}
/**
* It tests the getData method with processId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @test
*/
public function it_filter_by_thread_title()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// We need to commit the records inserted because is needed for the "fulltext" index
DB::commit();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set the title
$participated->setCaseTitle($cases->DEL_TITLE);
// Get the data
$res = $participated->getData();
// Asserts
$this->assertCount(1, $res);
}
/**
* It tests the getCounter method
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getCounter()
* @test
*/
public function it_should_test_the_counter_for_participated()
public function it_get_counter()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();

View File

@@ -3,6 +3,7 @@
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Paused;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppDelay;
@@ -15,8 +16,7 @@ use Tests\TestCase;
/**
* Class PausedTest
*
* @coversDefaultClass ProcessMaker\BusinessModel\Cases\Paused
* @package Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Paused
*/
class PausedTest extends TestCase
{
@@ -126,12 +126,12 @@ class PausedTest extends TestCase
* It tests the getData method without filters
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @test
*/
public function it_should_test_get_data_method_without_filters()
public function it_get_result_without_filters()
{
// Create factories related to the to_do cases
// Create factories related to the paused cases
$cases = $this->createPaused();
// Create new Paused object
$paused = new Paused();
@@ -146,14 +146,16 @@ class PausedTest extends TestCase
}
/**
* It tests the getData method with app number filter
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_should_test_get_data_by_case_number()
public function it_filter_by_app_number()
{
// Create factories related to the to_do cases
// Create factories related to the paused cases
$cases = $this->createPaused();
//Create new Paused object
$paused = new Paused();
@@ -173,11 +175,13 @@ class PausedTest extends TestCase
* It tests the getData method with taskId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_should_test_get_data_by_task_filter()
public function it_filter_by_task()
{
// Create factories related to the to_do cases
// Create factories related to the paused cases
$cases = $this->createPaused();
// Create new Paused object
$paused = new Paused();
@@ -194,14 +198,16 @@ class PausedTest extends TestCase
}
/**
* It tests the getData method using OrderBy Case Number
* It tests the getData method with processId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_should_test_get_data_by_process_filter()
public function it_filter_by_process()
{
// Create factories related to the to_do cases
// Create factories related to the paused cases
$cases = $this->createPaused();
// Create new Paused object
$paused = new Paused();
@@ -210,25 +216,32 @@ class PausedTest extends TestCase
// Set the user ID
$paused->setUserId($cases->USR_ID);
$paused->setProcessId($cases->PRO_ID);
// Call to getData method
// Get the data
$res = $paused->getData();
// Asserts
$this->assertNotEmpty($res);
}
/**
* It tests the getData method using OrderBy
* It tests the getData method with case title filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_should_test_get_data_by_case_title()
public function it_filter_by_thread_title()
{
// Create factories related to the to_do cases
// Create factories related to the paused cases
$cases = $this->createPaused();
// Create new Inbox object
// We need to commit the records inserted because is needed for the "fulltext" index
DB::commit();
// Create new Paused object
$paused = new Paused();
$paused->setUserUid($cases->USR_UID);
$paused->setUserId($cases->USR_ID);
// Set the title
$paused->setCaseTitle($cases->DEL_TITLE);
$res = $paused->getData();
$this->assertNotEmpty($res);
}

View File

@@ -3,6 +3,7 @@
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Search;
use ProcessMaker\Model\Delegation;
use Tests\TestCase;
@@ -43,9 +44,10 @@ class SearchTest extends TestCase
* It tests the getData method without filters
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @test
*/
public function it_should_test_get_data_method_without_filters()
public function it_get_result_without_filters()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
@@ -60,9 +62,11 @@ class SearchTest extends TestCase
* It tests the getData with case number
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @test
*/
public function it_should_test_get_data_method_with_specific_case_number()
public function it_filter_by_app_number()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
@@ -76,33 +80,15 @@ class SearchTest extends TestCase
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
}
/**
* It tests the getData with priority
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @test
*/
public function it_should_test_get_data_method_with_specific_priority()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
// Create new Search object
$search = new Search();
$search->setPriority('N');
// Set order by column value
$search->setOrderByColumn('APP_NUMBER');
$result = $search->getData();
// This assert that the expected numbers of results are returned
$this->assertNotEmpty($result);
}
/**
* It tests the getData with process
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @test
*/
public function it_should_test_get_data_method_with_specific_process()
public function it_filter_by_process()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
@@ -120,9 +106,11 @@ class SearchTest extends TestCase
* It tests the getData with task
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @test
*/
public function it_should_test_get_data_method_with_specific_task()
public function it_filter_by_task()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
@@ -136,13 +124,40 @@ class SearchTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* It tests the getData method with case title filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @test
*/
public function it_filter_by_thread_title()
{
// Create factories related to the to_do cases
$cases = $this->createSearch();
$title = $cases->last()->DEL_TITLE;
// We need to commit the records inserted because is needed for the "fulltext" index
DB::commit();
// Create new Draft object
$search = new Search();
// Set the title
$search->setCaseTitle($title);
// Get the data
$res = $search->getData();
// Asserts
$this->assertNotEmpty($res);
}
/**
* It tests the getData with user
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @test
*/
public function it_should_test_get_data_method_with_specific_user()
public function it_filter_by_user()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
@@ -156,6 +171,28 @@ class SearchTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* It tests the getData with priority
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @test
*/
public function it_filter_by_priority()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
// Create new Search object
$search = new Search();
$search->setPriority('N');
// Set order by column value
$search->setOrderByColumn('APP_NUMBER');
$result = $search->getData();
// This assert that the expected numbers of results are returned
$this->assertNotEmpty($result);
}
/**
* It tests the getCounter method
*

View File

@@ -3,6 +3,7 @@
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Supervising;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
@@ -188,7 +189,7 @@ class SupervisingTest extends TestCase
/**
* Tests the getData() method when the user belongs to a group supervisor
*
* covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @test
*/
public function it_should_test_the_get_data_method_when_the_user_belong_to_a_group_supervisor()
@@ -209,7 +210,7 @@ class SupervisingTest extends TestCase
/**
* Tests the getData() method when the user is not a supervisor neither belongs to a group supervisor
*
* covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @test
*/
public function it_should_test_the_get_data_method_when_the_user_is_not_supervisor()
@@ -231,7 +232,7 @@ class SupervisingTest extends TestCase
/**
* Tests the getCounter() method
*
* covers \ProcessMaker\BusinessModel\Cases\Supervising::getCounter()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getCounter()
* @test
*/
public function it_should_count_the_data()
@@ -252,662 +253,137 @@ class SupervisingTest extends TestCase
/**
* Tests the filter by APP_NUMBER
*
* covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @test
*/
public function it_filters_by_app_number()
public function it_filter_by_app_number()
{
//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,
]);
$task2 = factory(Task::class)->create([
'TAS_ASSIGN_TYPE' => 'NORMAL',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process->PRO_UID,
]);
$app1 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app2 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app3 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
//Create the register in delegation
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
//Create the register in the ProcessUser table
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
$Supervising->setUserUid($user->USR_UID);
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
$Supervising->setUserId($user->USR_ID);
$Supervising->setCaseNumber($app3['APP_NUMBER']);
$Supervising->setUserId($cases->USR_ID);
$Supervising->setCaseNumber($cases->APP_NUMBER);
//Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(1, $res);
//Asserts that the result contains the app number searched
$this->assertContains($app3['APP_NUMBER'], $res[0]);
$this->assertContains($cases->APP_NUMBER, $res[0]);
}
/**
* Tests the filter by process
*
* covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @test
*/
public function it_filters_by_process()
public function it_filter_by_process()
{
//Create process
$process = factory(Process::class)->create();
$process2 = 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,
]);
$task2 = factory(Task::class)->create([
'TAS_ASSIGN_TYPE' => 'NORMAL',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process->PRO_UID,
]);
$app1 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app2 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app3 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process2->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
//Create the register in delegation
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process2->PRO_ID,
'PRO_UID' => $process2->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process2->PRO_ID,
'PRO_UID' => $process2->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
//Create the register in the ProcessUser table
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process2->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
$Supervising->setUserUid($user->USR_UID);
//Set the user ID
$Supervising->setUserId($user->USR_ID);
//Set the process Id filter
$Supervising->setProcessId($process2['PRO_ID']);
//Call the getData method
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
// Set the process Id filter
$Supervising->setProcessId($cases->PRO_ID);
// Call the getData method
$res = $Supervising->getData();
$this->assertCount(1, $res);
}
/**
* Tests the filter by process
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @test
*/
public function it_filter_by_task()
{
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
// Set the process Id filter
$Supervising->setProcessId($cases->TAS_ID);
// Call the getData method
$res = $Supervising->getData();
$this->assertCount(1, $res);
}
/**
* It tests the getData method with case title filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @test
*/
public function it_filter_by_thread_title()
{
// Create factories related to the to_do cases
$cases = $this->createSupervising();
// We need to commit the records inserted because is needed for the "fulltext" index
DB::commit();
// Create new Inbox object
$supervising = new Supervising();
// Set the user UID
$supervising->setUserUid($cases->USR_UID);
// Set the user ID
$supervising->setUserId($cases->USR_ID);
// Set the title
$supervising->setCaseTitle($cases->DEL_TITLE);
// Get the data
$res = $supervising->getData();
// Asserts
$this->assertCount(1, $res);
}
/**
* Tests the order by value
*
* covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @test
*/
public function it_orders_the_query_by_column()
public function it_order_by_column()
{
//Create process
$process = factory(Process::class)->create();
$process2 = 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,
]);
$task2 = factory(Task::class)->create([
'TAS_ASSIGN_TYPE' => 'NORMAL',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process->PRO_UID,
]);
$app1 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app2 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app3 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process2->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
//Create the register in delegation
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process2->PRO_ID,
'PRO_UID' => $process2->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process2->PRO_ID,
'PRO_UID' => $process2->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
//Create the register in the ProcessUser table
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process2->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
// Create factories related to the supervising cases
$cases = $this->createSupervising();
$columnsView = [
'APP_NUMBER',
'DEL_TITLE',
'PRO_TITLE',
'TAS_TITLE',
'APP_CREATE_DATE',
'APP_FINISH_DATE'
];
$index = array_rand($columnsView);
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
$Supervising->setUserUid($user->USR_UID);
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
$Supervising->setUserId($user->USR_ID);
//Set the orderby value
$Supervising->setOrderByColumn('APPLICATION.APP_NUMBER');
$Supervising->setUserId($cases->USR_ID);
//Set the order by value
$Supervising->setOrderByColumn($columnsView[$index]);
//Call the getData method
$res = $Supervising->getData();
$this->assertCount(3, $res);
$this->assertTrue($res[0]['APP_NUMBER'] > $res[1]['APP_NUMBER']);
}
/**
* Tests the limit in the order by clausule
*
* covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @test
*/
public function it_set_the_limit_in_the_order_by_clausule()
{
//Create process
$process = factory(Process::class)->create();
$process2 = 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,
]);
$task2 = factory(Task::class)->create([
'TAS_ASSIGN_TYPE' => 'NORMAL',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process->PRO_UID,
]);
$app1 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app2 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app3 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process2->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
//Create the register in delegation
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process2->PRO_ID,
'PRO_UID' => $process2->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' =>0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process2->PRO_ID,
'PRO_UID' => $process2->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' =>1
]);
//Create the register in the ProcessUser table
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process2->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
$Supervising->setUserUid($user->USR_UID);
//Set the user ID
$Supervising->setUserId($user->USR_ID);
//Set the limit value
$Supervising->setLimit(1);
//Call the getData method
$res = $Supervising->getData();
$this->assertCount(1, $res);
}
}

View File

@@ -3,6 +3,7 @@
namespace Tests\unit\workflow\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\AppAssignSelfServiceValue;
use ProcessMaker\Model\AppAssignSelfServiceValueGroup;
@@ -23,6 +24,56 @@ class UnassignedTest extends TestCase
{
use DatabaseTransactions;
/**
* Create unassigned cases factories
*
* @param string
*
* @return array
*/
public function createSelfServiceUser()
{
// 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,
'PRO_ID' => $process->PRO_ID,
]);
//Assign a user in the task
$taskUser = 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
$delegation = factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'PRO_ID' => $process->PRO_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-$i year"))
]);
}
return [
'taskUser' => $taskUser,
'delegation' => $delegation
];
}
/**
* This checks the counters is working properly in self-service user assigned
*
@@ -806,577 +857,53 @@ class UnassignedTest extends TestCase
}
/**
* This ensures ordering ascending and descending works by case number APP_NUMBER in self-service-user-assigned
* This ensures get data from self-service-user-assigned without filters
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @test
*/
public function it_should_return_self_service_user_assigned_sort_by_case_number()
public function it_test_unassigned_by_user_without_filters()
{
//Create process
$process = factory(Process::class)->create();
//Create application
$application1 = factory(Application::class)->create([
'APP_STATUS_ID' => 2,
'APP_NUMBER' => 2001,
]);
$application2 = factory(Application::class)->create([
'APP_STATUS_ID' => 2,
'APP_NUMBER' => 2002,
]);
//Create user
$user = factory(User::class)->create();
//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, 2)->create([
'APP_NUMBER' => $application1->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
]);
//Create the register in delegation relate to self-service
factory(Delegation::class, 2)->create([
'APP_NUMBER' => $application2->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
]);
// Get first page, the minor case id
$unassigned = new Unassigned;
$unassigned->setUserUid($user->USR_UID);
// Create factories related to the unassigned cases
$cases = $this->createSelfServiceUser();
// Create new object
$unassigned = new Unassigned();
// Set the user UID
$unassigned->setUserUid($cases['taskUser']->USR_UID);
// Set OrderBYColumn value
$unassigned->setOrderByColumn('APP_NUMBER');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
$results = $unassigned->getData();
$this->assertEquals(2001, $results[0]['APP_NUMBER']);
$this->assertEquals(2001, $results[1]['APP_NUMBER']);
$this->assertEquals(2002, $results[2]['APP_NUMBER']);
$this->assertEquals(2002, $results[3]['APP_NUMBER']);
// Get first page, the major case id
$unassigned->setOrderDirection('DESC');
$results = $unassigned->getData();
$this->assertEquals(2002, $results[0]['APP_NUMBER']);
$this->assertEquals(2002, $results[1]['APP_NUMBER']);
$this->assertEquals(2001, $results[2]['APP_NUMBER']);
$this->assertEquals(2001, $results[3]['APP_NUMBER']);
// Call to getData method
$res = $unassigned->getData();
// This assert that the expected numbers of results are returned
$this->assertNotEmpty($res);
}
/**
* This ensures ordering ascending and descending works by case title APP_TITLE in self-service-user-assigned
* It tests the getData method with case title filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
* @test
*/
public function it_should_return_self_service_user_assigned_sort_by_case_title()
public function it_filter_by_thread_title()
{
$this->markTestIncomplete(
'This test needs to write when the column DELEGATION.DEL_THREAD was added'
);
//Create process
$process = factory(Process::class)->create();
//Create application
$application1 = factory(Application::class)->create([
'APP_STATUS_ID' => 2,
'APP_NUMBER' => 2001,
'APP_TITLE' => 'Request # 2001'
]);
$application2 = factory(Application::class)->create([
'APP_STATUS_ID' => 2,
'APP_NUMBER' => 2002,
'APP_TITLE' => 'Request # 2002'
]);
//Create user
$user = factory(User::class)->create();
//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, 2)->create([
'APP_NUMBER' => $application1->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
]);
//Create the register in delegation relate to self-service
factory(Delegation::class, 2)->create([
'APP_NUMBER' => $application2->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
]);
$unassigned = new Unassigned;
$unassigned->setUserUid($user->USR_UID);
$unassigned->setOrderByColumn('APPLICATION.APP_TITLE');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get first page, the minor case title
$results = $unassigned->getData();
$this->assertEquals('Request # 2001', $results[0]['APP_TITLE']);
$this->assertEquals('Request # 2001', $results[1]['APP_TITLE']);
$this->assertEquals('Request # 2002', $results[2]['APP_TITLE']);
$this->assertEquals('Request # 2002', $results[3]['APP_TITLE']);
// Get first page, the major case title
$unassigned->setOrderDirection('DESC');
$results = $unassigned->getData();
$this->assertEquals('Request # 2002', $results[0]['APP_TITLE']);
$this->assertEquals('Request # 2002', $results[1]['APP_TITLE']);
$this->assertEquals('Request # 2001', $results[2]['APP_TITLE']);
$this->assertEquals('Request # 2001', $results[3]['APP_TITLE']);
}
/**
* This ensures ordering ascending and descending works by case title PRO_TITLE in self-service-user-assigned
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @test
*/
public function it_should_return_self_service_user_assigned_sort_by_process()
{
//Create user
$user = factory(User::class)->create();
for ($i = 1; $i <= 2; $i++) {
$process = factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_STATUS_ID' => 2
]);
$task = factory(Task::class)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
//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_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->setOrderByColumn('PRO_TITLE');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get first page, the minor process title
$results = $unassigned->getData();
$this->assertGreaterThan($results[0]['PRO_TITLE'], $results[1]['PRO_TITLE']);
// Get first page, the major process title
$unassigned->setOrderDirection('DESC');
$results = $unassigned->getData();
$this->assertLessThan($results[0]['PRO_TITLE'], $results[1]['PRO_TITLE']);
}
/**
* This ensures ordering ascending and descending works by task title TAS_TITLE in self-service-user-assigned
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @test
*/
public function it_should_return_self_service_user_assigned_sort_by_task_title()
{
//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
]);
factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'PRO_ID' => $process->id,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
]);
}
$unassigned = new Unassigned;
$unassigned->setUserUid($user->USR_UID);
$unassigned->setOrderByColumn('TAS_TITLE');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get first page, the minor task title
$results = $unassigned->getData();
$this->assertGreaterThan($results[0]['TAS_TITLE'], $results[1]['TAS_TITLE']);
// Get first page, the major task title
$unassigned->setOrderDirection('DESC');
$results = $unassigned->getData();
$this->assertLessThan($results[0]['TAS_TITLE'], $results[1]['TAS_TITLE']);
}
/**
* This ensures ordering ascending and descending works by due date DEL_TASK_DUE_DATE in self-service-user-assigned
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @test
*/
public function it_should_return_self_service_user_assigned_sort_due_date()
{
//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_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->setOrderByColumn('DEL_TASK_DUE_DATE');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get first page, the minor due date
$results = $unassigned->getData();
$this->assertGreaterThan($results[0]['DEL_TASK_DUE_DATE'], $results[1]['DEL_TASK_DUE_DATE']);
// Get first page, the major due date
$unassigned->setOrderDirection('DESC');
$results = $unassigned->getData();
$this->assertLessThan($results[0]['DEL_TASK_DUE_DATE'], $results[1]['DEL_TASK_DUE_DATE']);
}
/**
* This ensures ordering ascending and descending works by last modified APP_UPDATE_DATE in
* self-service-user-assigned
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @test
*/
public function it_should_return_self_service_user_assigned_sort_delegate_date()
{
//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_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->setOrderByColumn('DEL_DELEGATE_DATE');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get first page, the minor update date
$results = $unassigned->getData();
$this->assertGreaterThan($results[0]['DEL_DELEGATE_DATE'], $results[1]['DEL_DELEGATE_DATE']);
// Get first page, the major update date
$unassigned->setOrderDirection('DESC');
$results = $unassigned->getData();
$this->assertLessThan($results[0]['DEL_DELEGATE_DATE'], $results[1]['DEL_DELEGATE_DATE']);
}
/**
* This ensures searching by newest than 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_by_newest_than()
{
//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,
'PRO_ID' => $process->PRO_ID,
]);
//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
$del = factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'PRO_ID' => $process->PRO_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("+$i year"))
]);
}
$unassigned = new Unassigned;
$unassigned->setUserUid($user->USR_UID);
$dateToFilter = date('Y-m-d', strtotime('+1 year'));
$unassigned->setDelegateFrom($dateToFilter);
$unassigned->setOrderByColumn('DEL_DELEGATE_DATE');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get the newest than (>=) delegate date
$results = $unassigned->getData();
$this->assertGreaterThan($results[0]['DEL_DELEGATE_DATE'], $results[1]['DEL_DELEGATE_DATE']);
// Get the newest than (>=) delegate date
$unassigned->setDelegateFrom($dateToFilter);
$unassigned->setOrderDirection('DESC');
$results = $unassigned->getData();
$this->assertLessThan($results[0]['DEL_DELEGATE_DATE'], $results[1]['DEL_DELEGATE_DATE']);
}
/**
* This ensures searching by newest than 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_by_oldest_than()
{
//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
$del = factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'TAS_ID' => $task->TAS_ID,
'PRO_ID' => $process->PRO_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-$i year"))
]);
}
$unassigned = new Unassigned;
$unassigned->setUserUid($user->USR_UID);
$dateToFilter = date('Y-m-d', strtotime('+1 year'));
$unassigned->setDelegateTo($dateToFilter);
$unassigned->setOrderByColumn('DEL_DELEGATE_DATE');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get the oldest than (<=) delegate date
$results = $unassigned->getData();
$this->assertGreaterThan($results[0]['DEL_DELEGATE_DATE'], $results[1]['DEL_DELEGATE_DATE']);
}
/**
* 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_case_uid()
{
//Create user
$user = factory(User::class)->create();
for ($i = 1; $i <= 2; $i++) {
//Create process
$process = factory(Process::class)->create([
'PRO_TITLE' => 'China Supplier Payment Proposal'
]);
//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->setOrderByColumn('APP_DELEGATION.APP_UID');
$unassigned->setOrderDirection('ASC');
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get the specific case uid
$unassigned->setCaseUid($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
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @test
*/
public function it_should_search_self_service_user_assigned_specific_process()
{
//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_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->setOrderByColumn('PRO_TITLE');
$unassigned->setOrderDirection('ASC');
$unassigned->setProcessId($process->PRO_ID);
$unassigned->setOffset(0);
$unassigned->setLimit(25);
// Get first page, the minor process title
$results = $unassigned->getData();
$this->assertEquals($process->PRO_TITLE, $results[0]['PRO_TITLE']);
// Create factories related to the unassigned cases
$cases = $this->createSelfServiceUser();
$usrUid = $cases->last()->USR_UID;
$usrId = $cases->last()->USR_ID;
$title = $cases->last()->DEL_TITLE;
// We need to commit the records inserted because is needed for the "fulltext" index
DB::commit();
// Create new Unassigned object
$unassigned = new Unassigned();
$unassigned->setUserUid($usrUid);
$unassigned->setUserId($usrId);
// Set the title
$unassigned->setCaseTitle($title);
// Get the data
$res = $unassigned->getData();
// Asserts
$this->assertNotEmpty($res);
}
}