Files
luos/tests/unit/workflow/engine/src/ProcessMaker/Model/AbeConfigurationTest.php
Fabio Guachalla 90a8150bd7 PMC-778
2019-10-04 12:08:54 -04:00

108 lines
3.5 KiB
PHP

<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\AbeConfiguration;
use ProcessMaker\Model\AbeRequest;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Dynaform;
use ProcessMaker\Model\EmailServerModel;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
use Tests\TestCase;
class AbeConfigurationTest extends TestCase
{
/**
* Call the setUp parent method
*/
public function setUp()
{
parent::setUp(); // TODO: Change the autogenerated stub
}
/**
* Call the tearDown parent method
*/
public function tearDown()
{
parent::tearDown(); // TODO: Change the autogenerated stub
}
/**
* Test the getAbeRequest method
*
* @covers \ProcessMaker\Model\AbeConfiguration::getAbeRequest()
* @test
*/
public function it_should_test_the_get_abe_request_method()
{
//Create the Task factory
factory(Task::class)->create();
//Create the Process factory
factory(Process::class)->create();
//Create the Dynaform factory
factory(Dynaform::class)->create();
//Create the EmailServerModel factory
factory(EmailServerModel::class)->create();
//Create the Application factory
factory(Application::class)->create();
//Create the Delegation factory
$delegation = factory(Delegation::class)->create();
//Create the AbeConfiguration factory
$abeConfiguration = factory(AbeConfiguration::class)->create();
//Create the AbeConfiguration factory
factory(AbeRequest::class)->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation->APP_UID,
'DEL_INDEX' => $delegation->DEL_INDEX,
'ABE_REQ_UID' => $abeConfiguration->ABE_UID
]);
//Call the getAbeRequest method
$res = AbeConfiguration::getAbeRequest($abeConfiguration->ABE_UID);
//Assert the result is not empty
$this->assertNotEmpty($res);
//Assert the result is the one looked for
$this->assertEquals($res['ABE_UID'], $abeConfiguration->ABE_UID);
}
/**
* Tests the getAbeRequest method when the result is empty
*
* @covers \ProcessMaker\Model\AbeConfiguration::getAbeRequest()
* @test
*/
public function it_should_test_the_get_abe_request_method_when_the_result_is_empty()
{
//Creates the Task factory
factory(Task::class)->create();
//Creates the Process factory
factory(Process::class)->create();
//Creates the Dynaform factory
factory(Dynaform::class)->create();
//Creates the EmailServer factory
factory(EmailServerModel::class)->create();
//Creates the Application factory
factory(Application::class)->create();
//Creates the Delegation factory
$delegation = factory(Delegation::class)->create();
//Creates the AbeConfiguration factory
$abeConfiguration = factory(AbeConfiguration::class)->create();
//Creates the AbeConfiguration factory
factory(AbeRequest::class)->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation->APP_UID,
'DEL_INDEX' => $delegation->DEL_INDEX,
'ABE_REQ_UID' => $abeConfiguration->ABE_UID
]);
//Call the getAbeRequest method
$res = AbeConfiguration::getAbeRequest('');
//Asserts the result has one record
$this->assertEmpty($res);
}
}