PMCORE-2524: Conflicts with develop
This commit is contained in:
@@ -144,6 +144,7 @@ class DerivationTest extends TestCase
|
||||
];
|
||||
$appFields = [
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'DEL_INDEX' => $appDelegation->DEL_INDEX,
|
||||
'DEL_THREAD' => $appDelegation->DEL_THREAD,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
|
||||
84
tests/unit/workflow/engine/classes/WorkspaceToolsTest.php
Normal file
84
tests/unit/workflow/engine/classes/WorkspaceToolsTest.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use Tests\TestCase;
|
||||
|
||||
class WorkspaceToolsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Tests the migrateCaseTitleToThreads method
|
||||
*
|
||||
* @covers \WorkspaceTools::migrateCaseTitleToThreads
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_migrate_case_title_to_threads_method()
|
||||
{
|
||||
$application1 = factory(Application::class)->create([
|
||||
'APP_STATUS' => 'TO_DO',
|
||||
'APP_STATUS_ID' => 2,
|
||||
]);
|
||||
$application2 = factory(Application::class)->create([
|
||||
'APP_STATUS' => 'COMPLETED',
|
||||
'APP_STATUS_ID' => 3,
|
||||
]);
|
||||
$application3 = factory(Application::class)->create([
|
||||
'APP_STATUS' => 'CANCELED',
|
||||
'APP_STATUS_ID' => 4,
|
||||
]);
|
||||
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'DEL_INDEX' => 1
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'DEL_INDEX' => 2
|
||||
]);
|
||||
$delegation1 = factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'DEL_INDEX' => 3,
|
||||
]);
|
||||
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application2->APP_UID,
|
||||
'APP_NUMBER' => $application2->APP_NUMBER,
|
||||
'DEL_INDEX' => 1
|
||||
]);
|
||||
$delegation2 = factory(Delegation::class)->create([
|
||||
'APP_UID' => $application2->APP_UID,
|
||||
'APP_NUMBER' => $application2->APP_NUMBER,
|
||||
'DEL_INDEX' => 2,
|
||||
'DEL_LAST_INDEX' => 1
|
||||
]);
|
||||
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application3->APP_UID,
|
||||
'APP_NUMBER' => $application3->APP_NUMBER,
|
||||
'DEL_INDEX' => 1
|
||||
]);
|
||||
$delegation3 = factory(Delegation::class)->create([
|
||||
'APP_UID' => $application3->APP_UID,
|
||||
'APP_NUMBER' => $application3->APP_NUMBER,
|
||||
'DEL_INDEX' => 2,
|
||||
'DEL_LAST_INDEX' => 1
|
||||
]);
|
||||
|
||||
$workspaceTools = new WorkspaceTools('');
|
||||
$workspaceTools->migrateCaseTitleToThreads(['testexternal']);
|
||||
$result = ob_get_contents();
|
||||
$this->assertRegExp("/The Case Title has been updated successfully in APP_DELEGATION table./", $result);
|
||||
|
||||
$r = Delegation::select('DEL_TITLE')->where('DELEGATION_ID', $delegation1->DELEGATION_ID)->get()->values()->toArray();
|
||||
$this->assertEquals($r[0]['DEL_TITLE'], $application1->APP_TITLE);
|
||||
|
||||
$r = Delegation::select('DEL_TITLE')->where('DELEGATION_ID', $delegation2->DELEGATION_ID)->get()->values()->toArray();
|
||||
$this->assertEquals($r[0]['DEL_TITLE'], $application2->APP_TITLE);
|
||||
|
||||
$r = Delegation::select('DEL_TITLE')->where('DELEGATION_ID', $delegation3->DELEGATION_ID)->get()->values()->toArray();
|
||||
$this->assertEquals($r[0]['DEL_TITLE'], $application3->APP_TITLE);
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ class CasesTraitTest extends TestCase
|
||||
$task2 = $result->task2;
|
||||
|
||||
$processUid = $application->PRO_UID;
|
||||
$application = $application->APP_UID;
|
||||
$appUid = $application->APP_UID;
|
||||
$postForm = [
|
||||
'ROU_TYPE' => 'SEQUENTIAL',
|
||||
'TASKS' => [
|
||||
@@ -229,9 +229,9 @@ class CasesTraitTest extends TestCase
|
||||
$userLogged = $user->USR_UID;
|
||||
|
||||
$cases = new Cases();
|
||||
$cases->routeCase($processUid, $application, $postForm, $status, $flagGmail, $tasUid, $index, $userLogged);
|
||||
$cases->routeCase($processUid, $appUid, $postForm, $status, $flagGmail, $tasUid, $index, $userLogged);
|
||||
|
||||
$result = Delegation::where('APP_UID', '=', $application)->where('DEL_INDEX', '=', $index)->get()->first();
|
||||
$result = Delegation::where('APP_UID', '=', $appUid)->where('DEL_INDEX', '=', $index)->get()->first();
|
||||
|
||||
$this->assertEquals('CLOSED', $result->DEL_THREAD_STATUS);
|
||||
}
|
||||
|
||||
@@ -415,8 +415,7 @@ class DelegationTest extends TestCase
|
||||
->states('foreign_keys')
|
||||
->create();
|
||||
$title = $delegations->last()
|
||||
->application
|
||||
->APP_TITLE;
|
||||
->DEL_TITLE;
|
||||
// We need to commit the records inserted because is needed for the "fulltext" index
|
||||
DB::commit();
|
||||
|
||||
@@ -2510,4 +2509,33 @@ class DelegationTest extends TestCase
|
||||
$result = Delegation::participation($application->APP_UID, $user->USR_UID);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This check the return of thread title
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Delegation::getThreadTitle()
|
||||
* @test
|
||||
*/
|
||||
public function it_get_thread_title()
|
||||
{
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
|
||||
$result = Delegation::getThreadTitle($delegation->TAS_UID, $delegation->APP_NUMBER, $delegation->DEL_INDEX, []);
|
||||
$this->assertNotEmpty($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getDeltitle() method
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Delegation::getDeltitle()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_the_get_del_title_method()
|
||||
{
|
||||
$delegation = factory(Delegation::class)->create([
|
||||
'DEL_TITLE' => "test"
|
||||
]);
|
||||
$result = Delegation::getDeltitle($delegation->APP_NUMBER, $delegation->DEL_INDEX);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($result, $delegation->DEL_TITLE);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||
use G;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\ElementTaskRelation;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\Task;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -124,4 +126,64 @@ class TaskTest extends TestCase
|
||||
$result .= ' 01 '. G::LoadTranslation('ID_SECOND_ABBREVIATE');
|
||||
$this->assertEquals($taskInfo['DURATION'], $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the setTaskDefTitle() method
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Task::setTaskDefTitle()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_set_task_title_method()
|
||||
{
|
||||
$project = factory(Process::class)->create();
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_DEF_TITLE' => 'something'
|
||||
]);
|
||||
$elementTask = factory(ElementTaskRelation::class)->create([
|
||||
'PRJ_UID' => $project->PRO_UID,
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
]);
|
||||
|
||||
Task::setTaskDefTitle($elementTask->ELEMENT_UID, "Task title new");
|
||||
$query = Task::query();
|
||||
$query->select()->where('TASK.TAS_UID', $task->TAS_UID);
|
||||
$res = $query->get()->values()->toArray();
|
||||
$this->assertEquals($res[0]['TAS_DEF_TITLE'], 'Task title new');
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getTaskDefTitle() method
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Task::getTaskDefTitle()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_task_def_title_method()
|
||||
{
|
||||
$project = factory(Process::class)->create();
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_DEF_TITLE' => 'something'
|
||||
]);
|
||||
$elementTask = factory(ElementTaskRelation::class)->create([
|
||||
'PRJ_UID' => $project->PRO_UID,
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
]);
|
||||
|
||||
$res = Task::getTaskDefTitle($elementTask->ELEMENT_UID);
|
||||
|
||||
$this->assertEquals($res, $task->TAS_DEF_TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the get case title defined in the task
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Task::taskCaseTitle()
|
||||
* @test
|
||||
*/
|
||||
public function it_get_case_title()
|
||||
{
|
||||
$task = factory(Task::class)->create();
|
||||
$tas = new Task();
|
||||
$result = $tas->taskCaseTitle($task->TAS_UID);
|
||||
$this->assertNotEmpty($result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user