Solving conflicts merginf with last merge in develop branch
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\Model\AppTimeoutAction;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class DelegationTest
|
||||
*
|
||||
* @coversDefaultClass \ProcessMaker\Model\AppTimeoutAction
|
||||
*/
|
||||
class AppTimeoutActionTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Test set and get the caseUid property
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::setCaseUid()
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::getCaseUid()
|
||||
* @test
|
||||
*/
|
||||
public function it_set_get_case_uid()
|
||||
{
|
||||
factory(AppTimeoutAction::class)->create();
|
||||
$timeout = factory(AppTimeoutAction::class)->create();
|
||||
$timeout->setCaseUid($timeout->APP_UID);
|
||||
$this->assertEquals($timeout->getCaseUid(), $timeout->APP_UID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set and get the index property
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::setIndex()
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::getIndex()
|
||||
* @test
|
||||
*/
|
||||
public function it_set_get_index()
|
||||
{
|
||||
factory(AppTimeoutAction::class)->create();
|
||||
$timeout = factory(AppTimeoutAction::class)->create();
|
||||
$timeout->setIndex($timeout->DEL_INDEX);
|
||||
$this->assertEquals($timeout->getIndex(), $timeout->DEL_INDEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a query to only include a specific case
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::scopeCase()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_a_specific_case()
|
||||
{
|
||||
factory(AppTimeoutAction::class)->create();
|
||||
$timeout = factory(AppTimeoutAction::class)->create();
|
||||
$this->assertCount(1, $timeout->case($timeout->APP_UID)->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test scope a query to only include a specific case
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::scopeIndex()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_a_specific_index()
|
||||
{
|
||||
factory(AppTimeoutAction::class)->create();
|
||||
$timeout = factory(AppTimeoutAction::class)->create();
|
||||
$this->assertCount(1, $timeout->case($timeout->APP_UID)->index($timeout->DEL_INDEX)->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks it returns information about the self service timeout in a sequential thread
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::cases()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_the_case_executed_once_one_thread()
|
||||
{
|
||||
$records = factory(AppTimeoutAction::class, 5)->create();
|
||||
foreach ($records as $row) {
|
||||
$appUid = $row->APP_UID;
|
||||
$delIndex = $row->DEL_INDEX;
|
||||
}
|
||||
|
||||
$appTimeout = new AppTimeoutAction();
|
||||
$appTimeout->setCaseUid($appUid);
|
||||
$appTimeout->setIndex($delIndex);
|
||||
$caseExecuted = $appTimeout->cases();
|
||||
$this->assertNotEmpty($caseExecuted);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks it returns information about the self service timeout in a parallel thread
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AppTimeoutAction::cases()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_the_case_executed_once_more_than_one_thread()
|
||||
{
|
||||
$records = factory(AppTimeoutAction::class, 5)->create();
|
||||
foreach ($records as $row) {
|
||||
$appUid = $row->APP_UID;
|
||||
$delIndex = $row->DEL_INDEX;
|
||||
}
|
||||
// Create other thread in the same case
|
||||
factory(AppTimeoutAction::class)->create([
|
||||
'APP_UID' => $appUid,
|
||||
'DEL_INDEX' => $delIndex + 1,
|
||||
]);
|
||||
|
||||
$appTimeout = new AppTimeoutAction();
|
||||
$appTimeout->setCaseUid($appUid);
|
||||
$appTimeout->setIndex($delIndex);
|
||||
$caseExecuted = $appTimeout->cases();
|
||||
$this->assertNotEmpty($caseExecuted);
|
||||
}
|
||||
}
|
||||
@@ -300,5 +300,25 @@ class ListUnassignedTest extends TestCase
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,40 @@
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||
|
||||
use G;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\Triggers;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class DelegationTest
|
||||
*
|
||||
* @coversDefaultClass \ProcessMaker\Model\Triggers
|
||||
*/
|
||||
class TriggersTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Test set and get the trigger property
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Triggers::setTrigger()
|
||||
* @covers \ProcessMaker\Model\Triggers::getTrigger()
|
||||
* @test
|
||||
*/
|
||||
public function it_set_get_trigger()
|
||||
{
|
||||
factory(Triggers::class)->create();
|
||||
$trigger = factory(Triggers::class)->create();
|
||||
$trigger->setTrigger($trigger->TRI_UID);
|
||||
$this->assertEquals($trigger->getTrigger(), $trigger->TRI_UID);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the process scope in the trigger model
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Triggers::scopeProcess()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_process_scope_in_trigger_model()
|
||||
@@ -74,4 +100,48 @@ class TriggersTest extends TestCase
|
||||
$this->assertEquals($process[2]['PRO_UID'], $result[0]['PRO_UID']);
|
||||
$this->assertEquals($process[2]['PRO_UID'], $result[1]['PRO_UID']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test scope a query to only include a specific case
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Triggers::scopeTrigger()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_specific_tasks()
|
||||
{
|
||||
factory(Triggers::class)->create();
|
||||
$trigger = factory(Triggers::class)->create();
|
||||
$this->assertCount(1, $trigger->trigger($trigger->TRI_UID)->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks it returns information about the trigger
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Triggers::triggers()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_specific_trigger_information()
|
||||
{
|
||||
$triggers = factory(Triggers::class, 5)->create();
|
||||
$trigger = new Triggers();
|
||||
$trigger->setTrigger($triggers[0]->TRI_UID);
|
||||
$triggersList = $trigger->triggers();
|
||||
$this->assertCount(1, $triggersList);
|
||||
$this->assertEquals($triggers[0]->TRI_TITLE , $triggersList[0]['TRI_TITLE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks it returns empty when the trigger does not exist
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Triggers::triggers()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_empty_when_the_trigger_not_exist()
|
||||
{
|
||||
factory(Triggers::class)->create();
|
||||
$trigger = new Triggers();
|
||||
$trigger->setTrigger(G::generateUniqueID());
|
||||
$triggersList = $trigger->triggers();
|
||||
$this->assertEmpty($triggersList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user