PMCORE-3542

This commit is contained in:
Paula Quispe
2021-11-19 16:15:02 -04:00
parent 90948c3473
commit fe9d26c3fb
13 changed files with 346 additions and 36 deletions

View File

@@ -44,6 +44,7 @@ class InboxTest extends TestCase
{
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PREVIOUS' => 1,
'DEL_INDEX' => 2,
]);
@@ -118,6 +119,7 @@ class InboxTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setProcessId()
* @test
*/
public function it_filter_by_process()
@@ -126,9 +128,11 @@ class InboxTest extends TestCase
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$inbox->setProcessId($cases->PRO_ID);
$inbox->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
@@ -139,6 +143,7 @@ class InboxTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCaseNumber()
* @test
*/
public function it_filter_by_app_number()
@@ -147,9 +152,11 @@ class InboxTest extends TestCase
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$inbox->setCaseNumber($cases->APP_NUMBER);
$inbox->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
@@ -160,6 +167,7 @@ class InboxTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCasesNumbers()
* @test
*/
public function it_filter_by_specific_cases()
@@ -168,9 +176,11 @@ class InboxTest extends TestCase
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$inbox->setCasesNumbers([$cases->APP_NUMBER]);
$inbox->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
@@ -181,6 +191,8 @@ class InboxTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCasesNumbers()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setRangeCasesFromTo()
* @test
*/
public function it_filter_by_range_cases()
@@ -189,10 +201,13 @@ class InboxTest extends TestCase
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
$inbox->setCasesNumbers([$cases->APP_NUMBER]);
$inbox->setRangeCasesFromTo([$rangeOfCases]);
$inbox->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
@@ -212,18 +227,46 @@ class InboxTest extends TestCase
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$inbox->setTaskId($cases->TAS_ID);
// Call to getData method
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with setDelegateFrom and setDelegateTo filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setDelegateFrom()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setDelegateTo()
* @test
*/
public function it_filter_by_delegate_from_to()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$inbox->setDelegateFrom($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
$inbox->setDelegateTo($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
// Call to getData method
$res = $inbox->getData();
$this->assertEmpty($res);
}
/**
* It tests the getData method with case title filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCaseTitle()
* @test
*/
public function it_filter_by_thread_title()
@@ -245,12 +288,44 @@ class InboxTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* It tests the getData method with send by filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setSendBy()
* @test
*/
public function it_filter_send_by()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create the previous thread with the same user
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
'APP_NUMBER' => $cases->APP_NUMBER,
'APP_UID' => $cases->APP_UID,
'USR_ID' => $cases->USR_ID,
'DEL_THREAD_STATUS' => 'CLOSED',
'DEL_INDEX' => 1,
]);
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$inbox->setSendBy($cases->USR_ID);
// Call to getData method
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method using order by column
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setOrderByColumn()
* @test
*/
public function it_order_by_column()

View File

@@ -201,7 +201,7 @@ class PausedTest extends TestCase
* It tests the getData method without filters
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
* @covers \ProcessMaker\Model\Delegation::scopePaused()
* @test
*/
@@ -225,7 +225,7 @@ class PausedTest extends TestCase
* 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::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
@@ -251,7 +251,7 @@ class PausedTest extends TestCase
* 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::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
@@ -277,7 +277,7 @@ 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::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
@@ -303,7 +303,7 @@ class PausedTest extends TestCase
* 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::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
@@ -328,7 +328,7 @@ class PausedTest extends TestCase
* 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::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
@@ -348,6 +348,51 @@ class PausedTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with setDelegateFrom and setDelegateTo filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_filter_by_delegate_from_to()
{
// Create factories related to the paused cases
$cases = $this->createPaused();
// Create new Paused object
$paused = new Paused();
$paused->setUserUid($cases->USR_UID);
$paused->setUserId($cases->USR_ID);
$paused->setDelegateFrom($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
$paused->setDelegateTo($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
// Get data
$res = $paused->getData();
$this->assertEmpty($res);
}
/**
* It tests the getData method with send by filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::setSendBy()
* @test
*/
public function it_filter_send_by()
{
// Create factories related to the to_do cases
$cases = $this->createPaused();
// Create new Paused object
$paused = new Paused();
$paused->setUserId($cases->USR_ID);
$paused->setSendBy($cases->USR_ID);
$res = $paused->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getCounter() method
*

View File

@@ -211,6 +211,7 @@ class UnassignedTest extends TestCase
$cases = $this->createSelfServiceUserOrGroup();
//Review the count self-service
$unassigned = new Unassigned;
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$result = $unassigned->getCounter();
@@ -229,6 +230,7 @@ class UnassignedTest extends TestCase
$cases = $this->createSelfServiceByVariable();
//Review the count self-service
$unassigned = new Unassigned;
// Apply filters
$unassigned->setUserUid($cases['user']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$result = $unassigned->getCounter();
@@ -247,6 +249,7 @@ class UnassignedTest extends TestCase
$cases = $this->createSelfServiceUserOrGroup(2);
//Review the count self-service
$unassigned = new Unassigned;
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$result = $unassigned->getCounter();
@@ -265,6 +268,7 @@ class UnassignedTest extends TestCase
$cases = $this->createSelfServiceByVariable(2, false);
//Review the count self-service
$unassigned = new Unassigned;
// Apply filters
$unassigned->setUserUid($cases['user']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$result = $unassigned->getCounter();
@@ -284,10 +288,12 @@ class UnassignedTest extends TestCase
$casesGroup = $this->createSelfServiceUserOrGroup(2);
//Review the count self-service
$unassigned = new Unassigned;
// Apply filters
$unassigned->setUserUid($casesUser['taskUser']->USR_UID);
$unassigned->setUserId($casesUser['delegation']->USR_ID);
$result = $unassigned->getCounter();
$this->assertNotEmpty($result);
// Apply filters
$unassigned->setUserUid($casesGroup['taskUser']->USR_UID);
$unassigned->setUserId($casesGroup['delegation']->USR_ID);
$result = $unassigned->getCounter();
@@ -305,13 +311,15 @@ class UnassignedTest extends TestCase
{
$casesUser = $this->createSelfServiceByVariable();
$casesGroup = $this->createSelfServiceByVariable(2, false);
//Review the count self-service
// Review the count self-service
$unassigned = new Unassigned;
// Apply filters
$unassigned->setUserUid($casesUser['user']->USR_UID);
$unassigned->setUserId($casesUser['delegation']->USR_ID);
$result = $unassigned->getCounter();
$this->assertNotEmpty($result);
$unassigned = new Unassigned;
// Apply filters
$unassigned->setUserUid($casesGroup['user']->USR_UID);
$unassigned->setUserId($casesGroup['delegation']->USR_ID);
$result = $unassigned->getCounter();
@@ -331,9 +339,34 @@ class UnassignedTest extends TestCase
$cases = $this->createSelfServiceUserOrGroup();
// Create new object
$unassigned = new Unassigned();
// Set the user UID
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
// Set OrderByColumn value
$unassigned->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $unassigned->getData();
// This assert that the expected numbers of results are returned
$this->assertNotEmpty($res);
}
/**
* This ensures get data from self-service-user-assigned with filter setCasesNumbers
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
* @test
*/
public function it_filter_by_case_numbers()
{
// Create factories related to the unassigned cases
$cases = $this->createSelfServiceUserOrGroup();
// Create new object
$unassigned = new Unassigned();
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$unassigned->setCasesNumbers([$cases['delegation']->APP_NUMBER]);
// Set OrderBYColumn value
$unassigned->setOrderByColumn('APP_NUMBER');
// Call to getData method
@@ -342,6 +375,54 @@ class UnassignedTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* This ensures get data from self-service-user-assigned with filter setRangeCasesFromTo
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
* @test
*/
public function it_filter_by_range_cases()
{
// Create factories related to the unassigned cases
$cases = $this->createSelfServiceUserOrGroup();
// Create new object
$unassigned = new Unassigned();
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$rangeOfCases = $cases['delegation']->APP_NUMBER . "-" . $cases['delegation']->APP_NUMBER;
$unassigned->setRangeCasesFromTo([$rangeOfCases]);
// Call to getData method
$res = $unassigned->getData();
// This assert that the expected numbers of results are returned
$this->assertNotEmpty($res);
}
/**
* This ensures get data from self-service-user-assigned with setDelegateFrom and setDelegateTo filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
* @test
*/
public function it_filter_by_delegate_from_to()
{
// Create factories related to the unassigned cases
$cases = $this->createSelfServiceUserOrGroup();
// Create new object
$unassigned = new Unassigned();
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$unassigned->setDelegateFrom(date('Y-m-d'));
$unassigned->setDelegateTo(date('Y-m-d'));
// Call to getData method
$res = $unassigned->getData();
// This assert that the expected numbers of results are returned
$this->assertEmpty($res);
}
/**
* It tests the getData method with case title filter
*
@@ -361,9 +442,9 @@ class UnassignedTest extends TestCase
DB::commit();
// Create new Unassigned object
$unassigned = new Unassigned();
// Apply filters
$unassigned->setUserUid($usrUid);
$unassigned->setUserId($usrId);
// Set the title
$unassigned->setCaseTitle($title);
// Get the data
$res = $unassigned->getData();

View File

@@ -34,28 +34,28 @@ class TaskTest extends TestCase
]);
$taskInstance = new Task();
$title = $taskInstance->title($task->TAS_ID);
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_THROW_EMAIL_EVENT'));
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_THROW_EMAIL_EVENT'));
// Intermediate throw message event
$task = factory(Task::class)->create([
'TAS_TITLE' => 'INTERMEDIATE-THROW-MESSAGE-EVENT'
]);
$taskInstance = new Task();
$title = $taskInstance->title($task->TAS_ID);
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_THROW_MESSAGE_EVENT'));
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_THROW_MESSAGE_EVENT'));
// Intermediate catch message event
$task = factory(Task::class)->create([
'TAS_TITLE' => 'INTERMEDIATE-CATCH-MESSAGE-EVENT'
]);
$taskInstance = new Task();
$title = $taskInstance->title($task->TAS_ID);
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_CATCH_MESSAGE_EVENT'));
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_CATCH_MESSAGE_EVENT'));
// Intermediate timer event
$task = factory(Task::class)->create([
'TAS_TITLE' => 'INTERMEDIATE-CATCH-TIMER-EVENT'
]);
$taskInstance = new Task();
$title = $taskInstance->title($task->TAS_ID);
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_CATCH_TIMER_EVENT'));
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_CATCH_TIMER_EVENT'));
}
/**