Merged in bugfix/PMCORE-3053 (pull request #8015)
PMCORE-3053 Rest Services: Improve API related to home order to get the Custom cases list Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
ec7b157c00
@@ -5,7 +5,9 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\BusinessModel\Cases\Draft;
|
||||
use ProcessMaker\Model\AdditionalTables;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\User;
|
||||
@@ -719,4 +721,49 @@ class DraftTest extends TestCase
|
||||
$res = $draft->getCountersByRange(null, '2021-05-20', '2021-05-22');
|
||||
$this->assertCount(3, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCustomListCount() method.
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCustomListCount()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_getCustomListCount_method()
|
||||
{
|
||||
$cases = $this->createManyDraft(3);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||
. "PRIMARY KEY (`APP_UID`),"
|
||||
. "KEY `indexTable` (`APP_UID`))";
|
||||
DB::statement($query);
|
||||
|
||||
$caseList = factory(CaseList::class)->create([
|
||||
'CAL_TYPE' => 'draft',
|
||||
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||
'USR_ID' => $cases->USR_ID
|
||||
]);
|
||||
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($cases->USR_ID);
|
||||
$draft->setUserUid($cases->USR_UID);
|
||||
|
||||
$res = $draft->getCustomListCount($caseList->CAL_ID, 'draft');
|
||||
|
||||
//assertions
|
||||
$this->assertArrayHasKey('label', $res);
|
||||
$this->assertArrayHasKey('name', $res);
|
||||
$this->assertArrayHasKey('description', $res);
|
||||
$this->assertArrayHasKey('tableName', $res);
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ 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\AdditionalTables;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\Task;
|
||||
@@ -612,4 +614,49 @@ class InboxTest extends TestCase
|
||||
$res = $inbox->getCountersByRange(null, '2021-05-20', '2021-05-23');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCustomListCount() method.
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCustomListCount()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_getCustomListCounts_method()
|
||||
{
|
||||
$cases = $this->createMultipleInbox(3);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||
. "PRIMARY KEY (`APP_UID`),"
|
||||
. "KEY `indexTable` (`APP_UID`))";
|
||||
DB::statement($query);
|
||||
|
||||
$caseList = factory(CaseList::class)->create([
|
||||
'CAL_TYPE' => 'inbox',
|
||||
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||
'USR_ID' => $cases->USR_ID
|
||||
]);
|
||||
|
||||
$inbox = new Inbox();
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$inbox->setUserUid($cases->USR_UID);
|
||||
|
||||
$res = $inbox->getCustomListCount($caseList->CAL_ID, 'inbox');
|
||||
|
||||
//assertions
|
||||
$this->assertArrayHasKey('label', $res);
|
||||
$this->assertArrayHasKey('name', $res);
|
||||
$this->assertArrayHasKey('description', $res);
|
||||
$this->assertArrayHasKey('tableName', $res);
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ 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\AdditionalTables;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\AppDelay;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\Task;
|
||||
@@ -606,4 +608,49 @@ class PausedTest extends TestCase
|
||||
$res = $paused->getCountersByRange(null, '2021-05-20', '2021-05-23');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCustomListCount() method.
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCustomListCount()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_getCustomListCounts_method()
|
||||
{
|
||||
$cases = $this->createMultiplePaused(3);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||
. "PRIMARY KEY (`APP_UID`),"
|
||||
. "KEY `indexTable` (`APP_UID`))";
|
||||
DB::statement($query);
|
||||
|
||||
$caseList = factory(CaseList::class)->create([
|
||||
'CAL_TYPE' => 'paused',
|
||||
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||
'USR_ID' => $cases->USR_ID
|
||||
]);
|
||||
|
||||
$paused = new Paused();
|
||||
$paused->setUserId($cases->USR_ID);
|
||||
$paused->setUserUid($cases->USR_UID);
|
||||
|
||||
$res = $paused->getCustomListCount($caseList->CAL_ID, 'paused');
|
||||
|
||||
//assertions
|
||||
$this->assertArrayHasKey('label', $res);
|
||||
$this->assertArrayHasKey('name', $res);
|
||||
$this->assertArrayHasKey('description', $res);
|
||||
$this->assertArrayHasKey('tableName', $res);
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\BusinessModel\Cases\Unassigned;
|
||||
use ProcessMaker\Model\AdditionalTables;
|
||||
use ProcessMaker\Model\AppAssignSelfServiceValue;
|
||||
use ProcessMaker\Model\AppAssignSelfServiceValueGroup;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\GroupUser;
|
||||
use ProcessMaker\Model\Groupwf;
|
||||
@@ -657,4 +659,68 @@ class UnassignedTest extends TestCase
|
||||
$res = $unassigned->getCountersByRange(null, '2021-05-20', '2021-05-23');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCustomListCount() method
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCustomListCount()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_getCustomListCount_method()
|
||||
{
|
||||
$cases = $this->createMultipleUnassigned(0);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||
. "PRIMARY KEY (`APP_UID`),"
|
||||
. "KEY `indexTable` (`APP_UID`))";
|
||||
DB::statement($query);
|
||||
|
||||
$caseList = factory(CaseList::class)->create([
|
||||
'CAL_TYPE' => 'unassigned',
|
||||
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||
'USR_ID' => $cases->USR_ID
|
||||
]);
|
||||
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($cases->USR_ID);
|
||||
$unassigned->setUserUid($cases->USR_UID);
|
||||
|
||||
$res = $unassigned->getCustomListCount($caseList->CAL_ID, 'unassigned');
|
||||
|
||||
//assertions
|
||||
$this->assertArrayHasKey('label', $res);
|
||||
$this->assertArrayHasKey('name', $res);
|
||||
$this->assertArrayHasKey('description', $res);
|
||||
$this->assertArrayHasKey('tableName', $res);
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(0, $res['total']);
|
||||
|
||||
//for user or group
|
||||
$cases = $this->createSelfServiceUserOrGroup();
|
||||
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
|
||||
$res = $unassigned->getCustomListCount($caseList->CAL_ID, 'unassigned');
|
||||
|
||||
//assertions
|
||||
$this->assertArrayHasKey('label', $res);
|
||||
$this->assertArrayHasKey('name', $res);
|
||||
$this->assertArrayHasKey('description', $res);
|
||||
$this->assertArrayHasKey('tableName', $res);
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(0, $res['total']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user