Files
luos/tests/unit/workflow/engine/methods/cases/CasesOpenTest.php

91 lines
2.7 KiB
PHP
Raw Normal View History

2020-06-24 17:53:09 -04:00
<?php
namespace Tests\unit\workflow\engine\methods\cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Dynaform;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
use Publisher;
use RBAC;
use Tests\TestCase;
class CasesOpenTest extends TestCase
{
use DatabaseTransactions;
/**
* It test the cases_Open file when the jump action is set in the unassigned list
*
* @test
*/
public function it_should_test_the_jump_case()
{
global $RBAC;
global $G_PUBLISH;
$user = User::where('USR_ID', '=', 1)
->get()
->first();
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
$_SESSION['USR_USERNAME'] = $user['USR_USERNAME'];
$G_PUBLISH = new Publisher();
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->initRBAC();
$RBAC->loadUserRolePermission('PROCESSMAKER', $_SESSION['USER_LOGGED']);
$task = Task::factory()->create();
$dynaform = Dynaform::factory()->create();
$process = Process::factory()->create([
2020-06-24 17:53:09 -04:00
'PRO_DYNAFORMS' => $dynaform['DYN_UID']
]);
$application = Application::factory()->create([
2020-06-24 17:53:09 -04:00
'PRO_UID' => $process['PRO_UID'],
'APP_STATUS' => 'COMPLETED'
]);
$delegation = Delegation::factory()->create([
2020-06-24 17:53:09 -04:00
'APP_UID' => $application['APP_UID'],
'TAS_UID' => $task['TAS_UID'],
'DEL_INDEX' => 1,
'DEL_THREAD_STATUS' => 'CLOSED'
]);
Delegation::factory()->create([
2020-06-24 17:53:09 -04:00
'APP_UID' => $application['APP_UID'],
'TAS_UID' => $task['TAS_UID'],
'DEL_INDEX' => 2,
'DEL_LAST_INDEX' => 1,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_DELEGATE_DATE' => $delegation['DEL_DELEGATE_DATE']
]);
$_GET['APP_UID'] = $application['APP_UID'];
$_GET['DEL_INDEX'] = $delegation['DEL_INDEX'];
$_GET['action'] = 'jump';
define("PATH_GULLIVER_HOME", PATH_TRUNK . "gulliver" . PATH_SEP);
define("PATH_TEMPLATE", PATH_GULLIVER_HOME . "templates" . PATH_SEP);
//Turn on output buffering
ob_start();
//Call the tested file
require_once PATH_METHODS . 'cases/cases_Open.php';
//Return the contents of the output buffer
$outputBuffer = ob_get_contents();
//Clean the output buffer and turn off output buffering
ob_end_clean();
$res = '<html>';
$this->assertStringContainsString($res, $outputBuffer);
2020-06-24 17:53:09 -04:00
}
}