PMCORE-3832
This commit is contained in:
committed by
Paula.Quispe
parent
c4684271c6
commit
908e975d5f
@@ -72,7 +72,7 @@ class DraftTest extends TestCase
|
||||
'APP_INIT_USER_ID' => $user->USR_ID,
|
||||
'APP_CUR_USER' => $user->USR_UID,
|
||||
]);
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 1,
|
||||
'APP_UID' => $application->APP_UID,
|
||||
@@ -82,7 +82,7 @@ class DraftTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
return $user;
|
||||
return $delegation;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -758,8 +758,9 @@ class DraftTest extends TestCase
|
||||
public function it_should_test_getCustomListCount_method()
|
||||
{
|
||||
$cases = $this->createManyDraft(3);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$additionalTables = factory(AdditionalTables::class)->create([
|
||||
'PRO_UID' => $cases->PRO_UID
|
||||
]);
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
@@ -792,7 +793,7 @@ class DraftTest extends TestCase
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
$this->assertEquals(1, $res['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,14 +70,14 @@ class InboxTest extends TestCase
|
||||
$user = factory(\ProcessMaker\Model\User::class)->create();
|
||||
|
||||
for ($i = 0; $i < $cases; $i = $i + 1) {
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 2,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
]);
|
||||
}
|
||||
return $user;
|
||||
return $delegation;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -737,7 +737,9 @@ class InboxTest extends TestCase
|
||||
{
|
||||
$cases = $this->createMultipleInbox(3);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$additionalTables = factory(AdditionalTables::class)->create([
|
||||
'PRO_UID' => $cases->PRO_UID
|
||||
]);
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
@@ -770,7 +772,7 @@ class InboxTest extends TestCase
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
$this->assertEquals(1, $res['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -195,7 +195,7 @@ class PausedTest extends TestCase
|
||||
'APP_TYPE' => 'PAUSE'
|
||||
]);
|
||||
}
|
||||
return $user;
|
||||
return $delegation1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -691,7 +691,9 @@ class PausedTest extends TestCase
|
||||
{
|
||||
$cases = $this->createMultiplePaused(3);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$additionalTables = factory(AdditionalTables::class)->create([
|
||||
'PRO_UID' => $cases->PRO_UID
|
||||
]);
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
@@ -724,7 +726,7 @@ class PausedTest extends TestCase
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
$this->assertEquals(1, $res['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -208,16 +208,21 @@ class UnassignedTest extends TestCase
|
||||
'TU_RELATION' => 1, //Related to the user
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
$delegation = factory(Delegation::class)->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_ID' => 0,
|
||||
'USR_UID' => '',
|
||||
'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year"))
|
||||
]);
|
||||
}
|
||||
return $user;
|
||||
return [
|
||||
'taskUser' => $user,
|
||||
'delegation' => $delegation
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -525,8 +530,8 @@ class UnassignedTest extends TestCase
|
||||
// Create factories related to the unassigned cases
|
||||
$cases = $this->createMultipleUnassigned(3);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($cases->USR_ID);
|
||||
$unassigned->setUserUid($cases->USR_UID);
|
||||
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
// Get the total for the pagination
|
||||
$res = $unassigned->getCounter();
|
||||
$this->assertEquals(3, $res);
|
||||
@@ -544,8 +549,8 @@ class UnassignedTest extends TestCase
|
||||
// Create factories related to the unassigned cases
|
||||
$cases = $this->createMultipleUnassigned(3);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($cases->USR_ID);
|
||||
$unassigned->setUserUid($cases->USR_UID);
|
||||
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
// Get the total for the pagination
|
||||
$res = $unassigned->getPagingCounters();
|
||||
$this->assertEquals(3, $res);
|
||||
@@ -575,8 +580,8 @@ class UnassignedTest extends TestCase
|
||||
{
|
||||
$cases = $this->createMultipleUnassigned(3);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($cases->USR_ID);
|
||||
$unassigned->setUserUid($cases->USR_UID);
|
||||
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$res = $unassigned->getCountersByProcesses();
|
||||
$this->assertCount(3, $res);
|
||||
}
|
||||
@@ -656,8 +661,8 @@ class UnassignedTest extends TestCase
|
||||
{
|
||||
$cases = $this->createMultipleUnassigned(20);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($cases->USR_ID);
|
||||
$unassigned->setUserUid($cases->USR_UID);
|
||||
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$res = $unassigned->getCountersByProcesses(null, true);
|
||||
$this->assertCount(10, $res);
|
||||
}
|
||||
@@ -812,9 +817,10 @@ class UnassignedTest extends TestCase
|
||||
*/
|
||||
public function it_should_test_getCustomListCount_method()
|
||||
{
|
||||
$cases = $this->createMultipleUnassigned(0);
|
||||
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$cases = $this->createMultipleUnassigned(1);
|
||||
$additionalTables = factory(AdditionalTables::class)->create([
|
||||
'PRO_UID' => $cases['delegation']->PRO_UID
|
||||
]);
|
||||
$query = ""
|
||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||
. "`APP_UID` varchar(32) NOT NULL,"
|
||||
@@ -830,13 +836,12 @@ class UnassignedTest extends TestCase
|
||||
$caseList = factory(CaseList::class)->create([
|
||||
'CAL_TYPE' => 'unassigned',
|
||||
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||
'USR_ID' => $cases->USR_ID
|
||||
'USR_ID' => $cases['taskUser']->USR_ID
|
||||
]);
|
||||
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($cases->USR_ID);
|
||||
$unassigned->setUserUid($cases->USR_UID);
|
||||
|
||||
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$res = $unassigned->getCustomListCount($caseList->CAL_ID, 'unassigned');
|
||||
|
||||
//assertions
|
||||
@@ -847,7 +852,7 @@ class UnassignedTest extends TestCase
|
||||
$this->assertArrayHasKey('total', $res);
|
||||
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(0, $res['total']);
|
||||
$this->assertNotEmpty($res);
|
||||
|
||||
//for user or group
|
||||
$cases = $this->createSelfServiceUserOrGroup();
|
||||
|
||||
@@ -29,6 +29,34 @@ class CaseListTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCaseList method.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Model\CaseList::getCaseList()
|
||||
*/
|
||||
public function it_should_test_getCaseList()
|
||||
{
|
||||
$data = [
|
||||
'type' => 'inbox',
|
||||
'name' => 'test1',
|
||||
'description' => 'my description',
|
||||
'tableUid' => '',
|
||||
'columns' => [],
|
||||
'userId' => 1,
|
||||
'iconList' => 'deafult.png',
|
||||
'iconColor' => 'red',
|
||||
'iconColorScreen' => 'blue',
|
||||
'createDate' => date('Y-m-d H:i:s'),
|
||||
'updateDate' => date('Y-m-d H:i:s')
|
||||
];
|
||||
$model = CaseList::createSetting($data, $data['userId']);
|
||||
|
||||
$id = $model->CAL_ID;
|
||||
$type = $model->CAL_TYPE;
|
||||
$caseList = CaseList::getCaseList($id, $type);
|
||||
$this->assertNotEmpty($caseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getColumnNameFromAlias method.
|
||||
* @test
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||
|
||||
use Exception;
|
||||
use G;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\Model\Process;
|
||||
@@ -254,6 +255,27 @@ class ProcessTest extends TestCase
|
||||
$this->assertEquals('PUBLIC', $p[0]->PRO_TYPE_PROCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the exception
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Process::getProcessesFilter()
|
||||
* @test
|
||||
*/
|
||||
public function it_test_exception_get_process()
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
$result = Process::getProcessesFilter(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
25,
|
||||
'ASC',
|
||||
'OTHER_COLUMN_DOES_NOT_EXIST'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the process list
|
||||
*
|
||||
@@ -432,6 +454,19 @@ class ProcessTest extends TestCase
|
||||
$this->assertCount(1, Process::getProcessesForHome(null, null, 2, 1, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* It test get id
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Process::getIds()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_id()
|
||||
{
|
||||
$process = factory(Process::class)->create();
|
||||
$result = Process::getIds($process->PRO_UID, 'PRO_UID');
|
||||
$this->assertEquals($process->PRO_ID, $result[0]['PRO_ID']);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the isActive process
|
||||
*
|
||||
|
||||
@@ -157,9 +157,9 @@ class MetricsTest extends TestCase
|
||||
$unassignedTest = new UnassignedTest();
|
||||
$cases = $unassignedTest->createMultipleUnassigned(3);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($cases->USR_ID);
|
||||
$unassigned->setUserUid($cases->USR_UID);
|
||||
$this->initializeRestApi($cases->USR_UID);
|
||||
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$this->initializeRestApi($cases['taskUser']->USR_UID);
|
||||
$metrics = new Metrics();
|
||||
$res = $metrics->getCountersList();
|
||||
$this->assertNotEmpty($res);
|
||||
|
||||
Reference in New Issue
Block a user