Files
luos/tests/unit/workflow/engine/classes/PmFunctions/PMFGetProcessUidByNameTest.php
Paula Quispe 8fbcb712e5 PMCORE-3674
2022-04-27 12:48:00 -04:00

39 lines
1.1 KiB
PHP

<?php
namespace Tests\unit\workflow\engine\classes\PmFunctions;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\Model\Process;
use Tests\TestCase;
/**
* Test the PMFGetProcessUidByName() function
*
* @link https://wiki.processmaker.com/3.2/ProcessMaker_Functions/Process_Functions#PMFGetProcessUidByName.28.29
*/
class PMFGetProcessUidByNameTest extends TestCase
{
use DatabaseTransactions;
/**
* This tests if the "PMFGetProcessUidByName"
* @test
*/
public function it_return_process()
{
// Create process
$table = factory(Process::class)->create();
DB::commit();
$result = PMFGetProcessUidByName($table->PRO_TITLE);
$this->assertNotEmpty($result);
// When a process was defined in the session
$result = PMFGetProcessUidByName('');
$this->assertNotEmpty($result);
// When does not defined the session
$_SESSION['PROCESS'] = '';
$result = PMFGetProcessUidByName('');
$this->assertEmpty($result);
}
}