PMCORE-2562
This commit is contained in:
committed by
Paula Quispe
parent
a13649bb1d
commit
c1a92a6ae7
@@ -16,309 +16,6 @@ use Tests\TestCase;
|
||||
*/
|
||||
class ListUnassignedTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Method set up.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks to make sure pagination is working properly
|
||||
*
|
||||
* @covers ListUnassigned::loadList
|
||||
* @test
|
||||
*/
|
||||
public function it_should_return_pages_of_data()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
for ($x = 1; $x <= 5; $x++) {
|
||||
$list = factory(ListUnassigned::class)->states('foreign_keys')->create();
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $list->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1, //Related to the user
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
// Define the filters
|
||||
$filters = ['start' => 0, 'limit' => 2];
|
||||
// Get data first page
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertCount(2, $result);
|
||||
// Get data second page
|
||||
$filters = ['start' => 2, 'limit' => 2];
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertCount(2, $result);
|
||||
// Get data third page
|
||||
$filters = ['start' => 4, 'limit' => 2];
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures ordering ascending and descending works by case number APP_NUMBER
|
||||
*
|
||||
* @covers ListUnassigned::loadList
|
||||
* @test
|
||||
*/
|
||||
public function it_should_sort_by_case_number()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
for ($x = 1; $x <= 5; $x++) {
|
||||
$list = factory(ListUnassigned::class)->states('foreign_keys')->create();
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $list->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1, //Related to the user
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
}
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_NUMBER', 'dir' => 'ASC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[0]['APP_NUMBER'], $result[1]['APP_NUMBER']);
|
||||
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_NUMBER', 'dir' => 'DESC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[1]['APP_NUMBER'], $result[0]['APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures ordering ascending and descending works by case number APP_TITLE
|
||||
*
|
||||
* @covers ListUnassigned::loadList
|
||||
* @test
|
||||
*/
|
||||
public function it_should_sort_by_case_title()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
for ($x = 1; $x <= 5; $x++) {
|
||||
$list = factory(ListUnassigned::class)->states('foreign_keys')->create();
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $list->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1, //Related to the user
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
}
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_TITLE', 'dir' => 'ASC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[0]['APP_TITLE'], $result[1]['APP_TITLE']);
|
||||
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_TITLE', 'dir' => 'DESC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[1]['APP_TITLE'], $result[0]['APP_TITLE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures ordering ascending and descending works by case number APP_PRO_TITLE
|
||||
*
|
||||
* @covers ListUnassigned::loadList
|
||||
* @test
|
||||
*/
|
||||
public function it_should_sort_by_process()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
for ($x = 1; $x <= 5; $x++) {
|
||||
$list = factory(ListUnassigned::class)->states('foreign_keys')->create();
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $list->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1, //Related to the user
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
}
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_PRO_TITLE', 'dir' => 'ASC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[0]['APP_PRO_TITLE'], $result[1]['APP_PRO_TITLE']);
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_PRO_TITLE', 'dir' => 'DESC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[1]['APP_PRO_TITLE'], $result[0]['APP_PRO_TITLE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures ordering ascending and descending works by case number APP_TAS_TITLE
|
||||
*
|
||||
* @covers ListUnassigned::loadList
|
||||
* @test
|
||||
*/
|
||||
public function it_should_sort_by_task()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
for ($x = 1; $x <= 5; $x++) {
|
||||
$list = factory(ListUnassigned::class)->states('foreign_keys')->create();
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $list->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1, //Related to the user
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
}
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_TAS_TITLE', 'dir' => 'ASC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[0]['APP_TAS_TITLE'], $result[1]['APP_TAS_TITLE']);
|
||||
//Define the filters
|
||||
$filters = ['sort' => 'APP_TAS_TITLE', 'dir' => 'DESC'];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertGreaterThan($result[1]['APP_TAS_TITLE'], $result[0]['APP_TAS_TITLE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks to make sure filter by category is working properly
|
||||
*
|
||||
* @covers ListUnassigned::loadList
|
||||
* @test
|
||||
*/
|
||||
public function it_should_return_data_filtered_by_process_category()
|
||||
{
|
||||
//Create user
|
||||
$user = factory(User::class)->create();
|
||||
//Create a category
|
||||
$category = factory(ProcessCategory::class)->create();
|
||||
//Create process
|
||||
$process = factory(Process::class)->create([
|
||||
'PRO_CATEGORY' => $category->CATEGORY_UID
|
||||
]);
|
||||
//Create a category
|
||||
$category1 = factory(ProcessCategory::class)->create();
|
||||
//Create process
|
||||
$process1 = factory(Process::class)->create([
|
||||
'PRO_CATEGORY' => $category1->CATEGORY_UID
|
||||
]);
|
||||
//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 list unassigned
|
||||
factory(ListUnassigned::class, 2)->create([
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
]);
|
||||
//Create the register in list unassigned
|
||||
factory(ListUnassigned::class, 5)->create([
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
]);
|
||||
//Get all data
|
||||
$result = ListUnassigned::loadList($user->USR_UID);
|
||||
$this->assertCount(7, $result);
|
||||
//Define the filters
|
||||
$filters = ['category' => $category->CATEGORY_UID];
|
||||
//Get data
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertCount(2, $result);
|
||||
//Get the minor case number first
|
||||
$this->assertEquals($category->CATEGORY_UID, $result[0]['PRO_CATEGORY']);
|
||||
//Get the major case number second
|
||||
$this->assertEquals($category->CATEGORY_UID, $result[1]['PRO_CATEGORY']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks to make sure filter by category is working properly
|
||||
*
|
||||
* @covers ListUnassigned::loadList
|
||||
* @test
|
||||
*/
|
||||
public function it_should_return_data_filtered_by_generic_search()
|
||||
{
|
||||
//Create user
|
||||
$user = factory(User::class)->create();
|
||||
//Create process
|
||||
$process = factory(Process::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 list unassigned
|
||||
factory(ListUnassigned::class, 2)->create([
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'APP_TITLE' => 'This is a case name',
|
||||
]);
|
||||
//Create the register in list unassigned
|
||||
factory(ListUnassigned::class, 2)->create([
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'APP_PRO_TITLE' => 'This is a process name',
|
||||
]);
|
||||
//Create the register in list unassigned
|
||||
factory(ListUnassigned::class, 2)->create([
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'APP_TAS_TITLE' => 'This is a task name',
|
||||
]);
|
||||
//Create other registers
|
||||
factory(ListUnassigned::class, 4)->create([
|
||||
'TAS_ID' => $task->TAS_ID
|
||||
]);
|
||||
//Define the filters
|
||||
$filters = ['search' => 'case name'];
|
||||
//Get data related to the search
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertCount(2, $result);
|
||||
//Define the filters
|
||||
$filters = ['search' => 'process name'];
|
||||
//Get data related to the search
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertCount(2, $result);
|
||||
//Define the filters
|
||||
$filters = ['search' => 'task name'];
|
||||
//Get data related to the search
|
||||
$result = ListUnassigned::loadList($user->USR_UID, $filters);
|
||||
$this->assertCount(2, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks the self-service timeout cases
|
||||
*
|
||||
* @covers \ProcessMaker\Model\ListUnassigned::selfServiceTimeout()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_return_cases_configured_self_service_timeout()
|
||||
{
|
||||
// Create some cases configured the self service timeout
|
||||
for ($x = 1; $x <= 5; $x++) {
|
||||
$task = factory(Task::class)->states('sef_service_timeout')->create();
|
||||
factory(ListUnassigned::class)->create([
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
'TAS_ID' => $task->TAS_ID
|
||||
]);
|
||||
}
|
||||
$results = ListUnassigned::selfServiceTimeout();
|
||||
$this->assertCount(5, $results);
|
||||
}
|
||||
// The ListUnassigned class was deprecated in Release 3.6.0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
require_once 'classes/model/om/BaseListCanceled.php';
|
||||
|
||||
/**
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListCanceled extends BaseListCanceled implements ListInterface
|
||||
{
|
||||
use ListBaseTrait;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListCanceledPeer extends BaseListCanceledPeer {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ require_once 'classes/model/om/BaseListCompleted.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.3.9
|
||||
* @deprecated Class deprecated in Release 3.3.9
|
||||
*/
|
||||
class ListCompleted extends BaseListCompleted implements ListInterface
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListCompletedPeer extends BaseListCompletedPeer {
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ use ProcessMaker\BusinessModel\User as BmUser;
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
|
||||
class ListInbox extends BaseListInbox implements ListInterface
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListInboxPeer extends BaseListInboxPeer {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ require_once 'classes/model/om/BaseListMyInbox.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListMyInbox extends BaseListMyInbox implements ListInterface
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListMyInboxPeer extends BaseListMyInboxPeer {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ require_once 'classes/model/om/BaseListParticipatedHistory.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListParticipatedHistory extends BaseListParticipatedHistory implements ListInterface
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListParticipatedHistoryPeer extends BaseListParticipatedHistoryPeer {
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListParticipatedLast extends BaseListParticipatedLast implements ListInterface
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListParticipatedLastPeer extends BaseListParticipatedLastPeer {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
|
||||
class ListPaused extends BaseListPaused implements ListInterface
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListPausedPeer extends BaseListPausedPeer {
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ use ProcessMaker\Model\Delegation;
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListUnassigned extends BaseListUnassigned implements ListInterface
|
||||
|
||||
@@ -13,7 +13,7 @@ require_once 'classes/model/om/BaseListUnassignedGroup.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListUnassignedGroup extends BaseListUnassignedGroup
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListUnassignedGroupPeer extends BaseListUnassignedGroupPeer {
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Class deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListUnassignedPeer extends BaseListUnassignedPeer {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user