PMCORE-3599

This commit is contained in:
Paula Quispe
2021-12-14 17:37:04 -04:00
parent d4beed9ae9
commit ba1562001b
32 changed files with 796 additions and 12 deletions

View File

@@ -12,3 +12,14 @@ $factory->define(\ProcessMaker\Model\GroupUser::class, function(Faker $faker) {
];
});
// Create columns from a table with the foreign keys
$factory->state(\ProcessMaker\Model\GroupUser::class, 'foreign_keys', function (Faker $faker) {
// Create values in the foreign key relations
$user = factory(\ProcessMaker\Model\User::class)->create();
$group = factory(\ProcessMaker\Model\Groupwf::class)->create();
return [
'GRP_UID' => $group->GRP_UID,
'GRP_ID' => $group->GRP_ID,
'USR_UID' => $user->USR_UID,
];
});

View File

@@ -7,6 +7,7 @@ use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\Groupwf::class, function(Faker $faker) {
return [
'GRP_UID' => G::generateUniqueID(),
'GRP_ID' => $faker->unique()->numberBetween(2000),
'GRP_TITLE' => $faker->sentence(2),
'GRP_STATUS' => 'ACTIVE',
'GRP_LDAP_DN' => '',

View File

@@ -7,6 +7,20 @@ $factory->define(\ProcessMaker\Model\ProcessUser::class, function(Faker $faker)
'PU_UID' => G::generateUniqueID(),
'PRO_UID' => G::generateUniqueID(),
'USR_UID' => G::generateUniqueID(),
'PU_TYPE' => $faker->word
'PU_TYPE' => 'SUPERVISOR'
];
});
// Create a process with the foreign keys
$factory->state(\ProcessMaker\Model\ProcessUser::class, 'foreign_keys', function (Faker $faker) {
// Create user
$user = factory(\ProcessMaker\Model\User::class)->create();
$process = factory(\ProcessMaker\Model\Process::class)->create();
return [
'PU_UID' => G::generateUniqueID(),
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
];
});

View File

@@ -437,6 +437,7 @@ class DraftTest extends TestCase
* It tests the getCountersByProcesses() method with the top ten filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses()
* @covers \ProcessMaker\Model\Delegation::scopeTopTen()
* @test
*/
public function it_should_test_get_counters_by_processes_method_top_ten()

View File

@@ -35,6 +35,7 @@ class UnassignedTest extends TestCase
{
parent::setUp();
Delegation::truncate();
Groupwf::truncate();
}
/**

View File

@@ -13,6 +13,11 @@ use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
use Tests\TestCase;
/**
* Class AbeConfigurationTest
*
* @coversDefaultClass \ProcessMaker\Model\AbeConfiguration
*/
class AbeConfigurationTest extends TestCase
{
/**

View File

@@ -0,0 +1,51 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\AbeConfiguration;
use ProcessMaker\Model\AbeRequest;
use ProcessMaker\Model\Application;
use Tests\TestCase;
/**
* Class AbeRequestTest
*
* @coversDefaultClass \ProcessMaker\Model\AbeRequest
*/
class AbeRequestTest extends TestCase
{
use DatabaseTransactions;
/**
* Test has one to APP_UID
*
* @covers \ProcessMaker\Model\AbeRequest::application()
* @test
*/
public function it_has_one_application()
{
$table = factory(AbeRequest::class)->create([
'APP_UID' => function () {
return factory(Application::class)->create()->APP_UID;
}
]);
$this->assertInstanceOf(Application::class, $table->application);
}
/**
* Test has one to ABE_UID
*
* @covers \ProcessMaker\Model\AbeRequest::abeConfiguration()
* @test
*/
public function it_has_one_abe_configuration()
{
$table = factory(AbeRequest::class)->create([
'ABE_UID' => function () {
return factory(AbeConfiguration::class)->create()->ABE_UID;
}
]);
$this->assertInstanceOf(AbeConfiguration::class, $table->abeConfiguration);
}
}

View File

@@ -6,6 +6,11 @@ use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Fields;
use Tests\TestCase;
/**
* Class AdditionalTablesTest
*
* @coversDefaultClass \ProcessMaker\Model\AdditionalTables
*/
class AdditionalTablesTest extends TestCase
{
/**
@@ -78,4 +83,23 @@ class AdditionalTablesTest extends TestCase
$this->assertArrayHasKey('rows', $row);
}
}
/**
* Test update the offline property
*
* @covers \ProcessMaker\Model\AdditionalTables::updatePropertyOffline()
* @test
*/
public function it_update_property_offline()
{
$pmTable = factory(AdditionalTables::class)->create(['ADD_TAB_OFFLINE' => 0]);
$results = AdditionalTables::updatePropertyOffline([$pmTable->ADD_TAB_UID], 1);
// Check the update
$pmTableQuery = AdditionalTables::query()->select(['ADD_TAB_OFFLINE']);
$pmTableQuery->where('ADD_TAB_UID', $pmTable->ADD_TAB_UID);
$result = $pmTableQuery->get()->values()->toArray();
// Assert, the update was executed
$this->assertEquals($result[0]['ADD_TAB_OFFLINE'], 1);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\AppAssignSelfServiceValue;
use ProcessMaker\Model\AppAssignSelfServiceValueGroup;
use Tests\TestCase;
/**
* Class AppAssignSelfServiceValueGroupTest
*
* @coversDefaultClass \ProcessMaker\Model\AppAssignSelfServiceValueGroup
*/
class AppAssignSelfServiceValueGroupTest extends TestCase
{
use DatabaseTransactions;
/**
* Test belongs to ID
*
* @covers \ProcessMaker\Model\AppAssignSelfServiceValueGroup::appSelfService()
* @test
*/
public function it_has_a_id_defined()
{
$table = factory(AppAssignSelfServiceValueGroup::class)->create([
'ID' => function () {
return factory(AppAssignSelfServiceValue::class)->create()->ID;
}
]);
$this->assertInstanceOf(AppAssignSelfServiceValue::class, $table->appSelfService);
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\AppAssignSelfServiceValue;
use ProcessMaker\Model\AppAssignSelfServiceValueGroup;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\GroupUser;
use ProcessMaker\Model\Groupwf;
use ProcessMaker\Model\RbacUsers;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
use Tests\TestCase;
/**
* Class AppAssignSelfServiceValueTest
*
* @coversDefaultClass \ProcessMaker\Model\AppAssignSelfServiceValue
*/
class AppAssignSelfServiceValueTest extends TestCase
{
use DatabaseTransactions;
/**
* Test belongs to APP_NUMBER
*
* @covers \ProcessMaker\Model\AppAssignSelfServiceValue::appNumber()
* @test
*/
public function it_belong_app_number()
{
$table = factory(AppAssignSelfServiceValue::class)->create([
'APP_NUMBER' => function () {
return factory(Delegation::class)->create()->APP_NUMBER;
}
]);
$this->assertInstanceOf(Delegation::class, $table->appNumber);
}
/**
* Test belongs to DEL_INDEX
*
* @covers \ProcessMaker\Model\AppAssignSelfServiceValue::index()
* @test
*/
public function it_belong_index()
{
$table = factory(AppAssignSelfServiceValue::class)->create([
'DEL_INDEX' => function () {
return factory(Delegation::class)->create()->DEL_INDEX;
}
]);
$this->assertInstanceOf(Delegation::class, $table->index);
}
/**
* Test belongs to TAS_ID
*
* @covers \ProcessMaker\Model\AppAssignSelfServiceValue::task()
* @test
*/
public function it_belong_task()
{
$table = factory(AppAssignSelfServiceValue::class)->create([
'TAS_ID' => function () {
return factory(Task::class)->create()->TAS_ID;
}
]);
$this->assertInstanceOf(Task::class, $table->task);
}
/**
* It tests getSelfServiceCasesByEvaluatePerUser()
*
* @covers \ProcessMaker\Model\AppAssignSelfServiceValue::getSelfServiceCasesByEvaluatePerUser()
* @test
*/
public function it_should_self_service_by_value()
{
// Assign user in a group
$rbacUser = factory(RbacUsers::class)->create();
$user = factory(User::class)->create([
'USR_UID' => $rbacUser['USR_UID']
]);
$group = factory(Groupwf::class)->create();
$table = factory(GroupUser::class)->create([
'GRP_UID' => $group['GRP_UID'],
'GRP_ID' => $group['GRP_ID'],
'USR_UID' => $user['USR_UID'],
'USR_ID' => $user['USR_ID'],
]);
// Create the selfservice
$self = factory(AppAssignSelfServiceValue::class)->create([
'GRP_UID' => $group['GRP_UID'],
]);
$table = factory(AppAssignSelfServiceValueGroup::class)->create([
'ID' => $self['ID'],
'GRP_UID' => $group['GRP_UID'],
'ASSIGNEE_ID' => $group['GRP_ID'],
'ASSIGNEE_TYPE' => 2,
]);
$result = AppAssignSelfServiceValue::getSelfServiceCasesByEvaluatePerUser($user['USR_UID']);
$this->assertNotEmpty($result);
}
}

View File

@@ -7,7 +7,7 @@ use ProcessMaker\Model\AppTimeoutAction;
use Tests\TestCase;
/**
* Class DelegationTest
* Class AppTimeoutActionTest
*
* @coversDefaultClass \ProcessMaker\Model\AppTimeoutAction
*/

View File

@@ -0,0 +1,30 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\BpmnProject;
use Tests\TestCase;
/**
* Class BpmnProjectTest
*
* @coversDefaultClass \ProcessMaker\Model\BpmnProject
*/
class BpmnProjectTest extends TestCase
{
use DatabaseTransactions;
/**
* Test if is a BPMN process
*
* @covers \ProcessMaker\Model\BpmnProject::isBpmnProcess()
* @test
*/
public function it_is_bpmn_process()
{
$table = factory(BpmnProject::class)->create();
$result = BpmnProject::isBpmnProcess($table->PRJ_UID);
$this->assertEquals($result, 1);
}
}

View File

@@ -6,9 +6,13 @@ use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\CaseList;
use Tests\TestCase;
/**
* Class CaseListTest
*
* @coversDefaultClass \ProcessMaker\Model\CaseList
*/
class CaseListTest extends TestCase
{
/**
* setUp method.
*/
@@ -28,6 +32,7 @@ class CaseListTest extends TestCase
/**
* This tests the getColumnNameFromAlias method.
* @test
* @covers \ProcessMaker\Model\CaseList::getColumnNameFromAlias()
* @covers \ProcessMaker\Model\CaseList::createSetting()
*/
public function it_should_test_getColumnNameFromAlias()
@@ -67,6 +72,8 @@ class CaseListTest extends TestCase
* This tests the getAliasFromColumnName method.
* @test
* @covers \ProcessMaker\Model\CaseList::createSetting()
* @covers \ProcessMaker\Model\CaseList::getColumnNameFromAlias()
* @covers \ProcessMaker\Model\CaseList::getAliasFromColumnName()
*/
public function it_should_test_getAliasFromColumnName()
{
@@ -105,6 +112,7 @@ class CaseListTest extends TestCase
* This tests the createSetting method.
* @test
* @covers \ProcessMaker\Model\CaseList::createSetting()
* @covers \ProcessMaker\Model\CaseList::getColumnNameFromAlias()
*/
public function it_should_test_createSetting()
{
@@ -139,6 +147,7 @@ class CaseListTest extends TestCase
* This tests the updateSetting method.
* @test
* @covers \ProcessMaker\Model\CaseList::updateSetting()
* @covers \ProcessMaker\Model\CaseList::createSetting()
*/
public function it_should_test_updateSetting()
{
@@ -181,6 +190,7 @@ class CaseListTest extends TestCase
* This tests the deleteSetting method.
* @test
* @covers \ProcessMaker\Model\CaseList::deleteSetting()
* @covers \ProcessMaker\Model\CaseList::createSetting()
*/
public function it_should_test_deleteSetting()
{
@@ -217,6 +227,9 @@ class CaseListTest extends TestCase
/**
* This tests the getSetting method.
* @test
* @covers \ProcessMaker\Model\CaseList::getSetting()
* @covers \ProcessMaker\Model\CaseList::createSetting()
* @covers \ProcessMaker\Model\CaseList::getColumnNameFromAlias()
* @covers \ProcessMaker\Model\CaseList::deleteSetting()
*/
public function it_should_test_getSetting()
@@ -322,6 +335,9 @@ class CaseListTest extends TestCase
/**
* This tests the export method.
* @test
* @covers \ProcessMaker\Model\CaseList::getAliasFromColumnName()
* @covers \ProcessMaker\Model\CaseList::createSetting()
* @covers \ProcessMaker\Model\CaseList::getColumnNameFromAlias()
* @covers \ProcessMaker\Model\CaseList::export()
*/
public function it_should_test_export()

View File

@@ -5,9 +5,12 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\Consolidated;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use Tests\TestCase;
/**
* Class ConsolidatedTest
*
* @coversDefaultClass \ProcessMaker\Model\Consolidated
*/
class ConsolidatedTest extends TestCase
@@ -22,6 +25,22 @@ class ConsolidatedTest extends TestCase
parent::setUp();
}
/**
* Test belongs to TAS_UID
*
* @covers \ProcessMaker\Model\Consolidated::task()
* @test
*/
public function it_has_a_task()
{
$table = factory(Consolidated::class)->create([
'TAS_UID' => function () {
return factory(Task::class)->create()->TAS_UID;
}
]);
$this->assertInstanceOf(Task::class, $table->task);
}
/**
* Create consolidated cases factories
*
@@ -42,6 +61,7 @@ class ConsolidatedTest extends TestCase
* This checks the counters is working properly in draft
*
* @covers \ProcessMaker\Model\Consolidated::getCounterActive()
* @covers \ProcessMaker\Model\Consolidated::scopeActive()
* @test
*/
public function it_should_count_cases_consolidated()
@@ -57,7 +77,11 @@ class ConsolidatedTest extends TestCase
/**
* This checks the counters is working properly in consolidated
*
* @covers \ProcessMaker\Model\Consolidated::getCounterActive()
* @covers \ProcessMaker\Model\Consolidated::getConsolidated()
* @covers \ProcessMaker\Model\Consolidated::scopeJoinPendingCases()
* @covers \ProcessMaker\Model\Consolidated::scopeActive()
* @covers \ProcessMaker\Model\Consolidated::scopeJoinProcess()
* @covers \ProcessMaker\Model\Consolidated::scopeJoinTask()
* @test
*/
public function it_should_count_cases()

View File

@@ -47,4 +47,22 @@ class DocumentsTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* This test get files
*
* @test
* @covers \ProcessMaker\Model\Documents::getFiles()
* @covers \ProcessMaker\Model\Documents::scopeDocId()
*/
public function it_should_test_get_files()
{
$appNote = factory(AppNotes::class)->create();
$appDocument = factory(Documents::class)->create([
'DOC_ID' => $appNote->NOTE_ID
]);
$result = Documents::getFiles($appDocument->DOC_ID);
$this->assertNotEmpty($result);
}
}

View File

@@ -2,14 +2,86 @@
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\Dynaform;
use ProcessMaker\Model\Process;
use Tests\TestCase;
/**
* Class DynaformTest
*
* @coversDefaultClass \ProcessMaker\Model\Dynaform
*/
class DynaformTest extends TestCase
{
use DatabaseTransactions;
/**
* Call the setUp parent method
*/
public function setUp()
{
parent::setUp();
}
/**
* Test belongs to PRO_UID
*
* @covers \ProcessMaker\Model\Dynaform::process()
* @test
*/
public function it_has_a_process()
{
$dynaForm = factory(Dynaform::class)->create([
'PRO_UID' => function () {
return factory(Process::class)->create()->PRO_UID;
}
]);
$this->assertInstanceOf(Process::class, $dynaForm->process);
}
/**
* Tests get form by process
*
* @covers \ProcessMaker\Model\Dynaform::getByProUid()
* @test
*/
public function it_tests_get_by_pro_uid()
{
$dynaForm = factory(Dynaform::class)->states('foreign_keys')->create();
$result = Dynaform::getByProUid($dynaForm->PRO_UID);
$this->assertNotEmpty($result);
}
/**
* Tests get form by uid
*
* @covers \ProcessMaker\Model\Dynaform::getByDynUid()
* @test
*/
public function it_tests_get_by_dyn_uid()
{
$dynaForm = factory(Dynaform::class)->states('foreign_keys')->create();
$result = Dynaform::getByDynUid($dynaForm->DYN_UID);
$this->assertNotEmpty($result);
}
/**
* Tests get form by process excluding a uid
*
* @covers \ProcessMaker\Model\Dynaform::getByProUidExceptDynUid()
* @test
*/
public function it_tests_get_by_process_exclude_dyn_uid()
{
$dynaForm = factory(Dynaform::class)->states('foreign_keys')->create();
$result = Dynaform::getByProUidExceptDynUid($dynaForm->PRO_UID, $dynaForm->DYN_UID);
$this->assertEmpty($result);
}
/**
* It tests the process scope in the dynaform model
*
* @covers \ProcessMaker\Model\Dynaform::scopeProcess()
* @test
*/
public function it_should_test_process_scope_in_dynaform_model()

View File

@@ -6,6 +6,11 @@ use ProcessMaker\Model\EmailEvent;
use ProcessMaker\Model\EmailServerModel;
use Tests\TestCase;
/**
* Class EmailEventTest
*
* @coversDefaultClass \ProcessMaker\Model\EmailEvent
*/
class EmailEventTest extends TestCase
{
/**

View File

@@ -5,6 +5,11 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use ProcessMaker\Model\EmailServerModel;
use Tests\TestCase;
/**
* Class EmailServerModelTest
*
* @coversDefaultClass \ProcessMaker\Model\EmailServerModel
*/
class EmailServerModelTest extends TestCase
{
/**

View File

@@ -6,6 +6,11 @@ use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Fields;
use Tests\TestCase;
/**
* Class FieldsTest
*
* @coversDefaultClass \ProcessMaker\Model\Fields
*/
class FieldsTest extends TestCase
{
/**

View File

@@ -10,7 +10,7 @@ use ProcessMaker\Model\User;
use Tests\TestCase;
/**
* Class ProcessTest
* Class GroupUserTest
*
* @coversDefaultClass \ProcessMaker\Model\GroupUser
*/
@@ -18,9 +18,95 @@ class GroupUserTest extends TestCase
{
use DatabaseTransactions;
/**
* Method set up.
*/
public function setUp()
{
parent::setUp();
GroupUser::truncate();
}
/**
* Test belongs to USR_UID
*
* @covers \ProcessMaker\Model\GroupUser::user()
* @test
*/
public function it_belong_user()
{
$table = factory(GroupUser::class)->create([
'USR_UID' => function () {
return factory(User::class)->create()->USR_UID;
}
]);
$this->assertInstanceOf(User::class, $table->user);
}
/**
* Test belongs to GRP_ID
*
* @covers \ProcessMaker\Model\GroupUser::groupsWf()
* @test
*/
public function it_belong_group()
{
$table = factory(GroupUser::class)->create([
'GRP_ID' => function () {
return factory(Groupwf::class)->create()->GRP_ID;
}
]);
$this->assertInstanceOf(Groupwf::class, $table->groupsWf);
}
/**
* This test scopeUser
*
* @covers \ProcessMaker\Model\GroupUser::scopeUser()
* @test
*/
public function it_return_scope_user()
{
$table = factory(GroupUser::class)->states('foreign_keys')->create();
$this->assertNotEmpty($table->user($table->USR_UID)->get());
}
/**
* It tests the messages related assignUserToGroup() method
*
* @covers \ProcessMaker\Model\GroupUser::assignUserToGroup()
* @test
*/
public function it_should_test_message()
{
// When the user does not exist
$user = factory(User::class)->create();
$group = factory(Groupwf::class)->create();
$result = GroupUser::assignUserToGroup('', 0, '', 0);
$this->assertNotEmpty($result);
// When the group does not exist
$rbacUser = factory(RbacUsers::class)->create();
$user = factory(User::class)->create([
'USR_UID' => $rbacUser['USR_UID']
]);
$group = factory(Groupwf::class)->create();
$result = GroupUser::assignUserToGroup($user['USR_UID'], 0, '', 0);
$this->assertNotEmpty($result);
// When the user already exist in a group
$rbacUser = factory(RbacUsers::class)->create();
$user = factory(User::class)->create([
'USR_UID' => $rbacUser['USR_UID']
]);
$group = factory(Groupwf::class)->create();
GroupUser::assignUserToGroup($user['USR_UID'], $user['USR_ID'], $group['GRP_UID'], $group['GRP_ID']);
$result = GroupUser::assignUserToGroup($user['USR_UID'], $user['USR_ID'], $group['GRP_UID'], $group['GRP_ID']);
$this->assertNotEmpty($result);
}
/**
* It tests the assignUserToGroup() method
*
* @covers \ProcessMaker\Model\GroupUser::assignUserToGroup()
* @test
*/
public function it_should_test_the_assign_user_to_group_method()
@@ -46,6 +132,8 @@ class GroupUserTest extends TestCase
/**
* It tests the verifyUserIsInGroup() method
*
* @covers \ProcessMaker\Model\GroupUser::verifyUserIsInGroup()
* @covers \ProcessMaker\Model\GroupUser::assignUserToGroup()
* @test
*/
public function it_should_test_the_verify_user_is_in_group_method()

View File

@@ -3,11 +3,12 @@
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\GroupUser;
use ProcessMaker\Model\Groupwf;
use Tests\TestCase;
/**
* Class ProcessTest
* Class GroupwfTest
*
* @coversDefaultClass \ProcessMaker\Model\Groupwf
*/
@@ -15,6 +16,43 @@ class GroupwfTest extends TestCase
{
use DatabaseTransactions;
/**
* Method set up.
*/
public function setUp()
{
parent::setUp();
Groupwf::truncate();
}
/**
* Test belongs to GRP_ID
*
* @covers \ProcessMaker\Model\Groupwf::groupUsers()
* @test
*/
public function it_belong_group()
{
$table = factory(Groupwf::class)->create([
'GRP_ID' => function () {
return factory(GroupUser::class)->create()->GRP_ID;
}
]);
$this->assertInstanceOf(GroupUser::class, $table->groupUsers);
}
/**
* This test scopeActive
*
* @covers \ProcessMaker\Model\Groupwf::scopeActive()
* @test
*/
public function it_return_scope_active()
{
$table = factory(Groupwf::class)->create();
$this->assertNotEmpty($table->active()->get());
}
/**
* It tests the verifyGroupExists() method
*

View File

@@ -0,0 +1,60 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\InputDocument;
use ProcessMaker\Model\Process;
use Tests\TestCase;
/**
* Class InputDocumentTest
*
* @coversDefaultClass \ProcessMaker\Model\InputDocument
*/
class InputDocumentTest extends TestCase
{
use DatabaseTransactions;
/**
* Test belongs to PRO_UID
*
* @covers \ProcessMaker\Model\InputDocument::process()
* @test
*/
public function it_has_a_process_defined()
{
$table = factory(InputDocument::class)->create([
'PRO_UID' => function () {
return factory(Process::class)->create()->PRO_UID;
}
]);
$this->assertInstanceOf(Process::class, $table->process);
}
/**
* Test get input by process
*
* @covers \ProcessMaker\Model\InputDocument::getByProUid()
* @test
*/
public function it_get_by_process()
{
$table = factory(InputDocument::class)->create();
$result = InputDocument::getByProUid($table->PRO_UID);
$this->assertNotEmpty($result);
}
/**
* Test get input by uid
*
* @covers \ProcessMaker\Model\InputDocument::getByInpDocUid()
* @test
*/
public function it_get_by_uid()
{
$table = factory(InputDocument::class)->create();
$result = InputDocument::getByInpDocUid($table->INP_DOC_UID);
$this->assertNotEmpty($result);
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\OutputDocument;
use ProcessMaker\Model\Process;
use Tests\TestCase;
/**
* Class OutputDocumentTest
*
* @coversDefaultClass \ProcessMaker\Model\OutputDocument
*/
class OutputDocumentTest extends TestCase
{
use DatabaseTransactions;
/**
* Test belongs to PRO_UID
*
* @covers \ProcessMaker\Model\OutputDocument::process()
* @test
*/
public function it_has_a_process_defined()
{
$table = factory(OutputDocument::class)->create([
'PRO_UID' => function () {
return factory(Process::class)->create()->PRO_UID;
}
]);
$this->assertInstanceOf(Process::class, $table->process);
}
/**
* Test get output by process
*
* @covers \ProcessMaker\Model\OutputDocument::getByProUid()
* @test
*/
public function it_get_by_process()
{
$table = factory(OutputDocument::class)->create();
$result = OutputDocument::getByProUid($table->PRO_UID);
$this->assertNotEmpty($result);
}
/**
* Test get output by uid
*
* @covers \ProcessMaker\Model\OutputDocument::getByOutDocUid()
* @test
*/
public function it_get_by_uid()
{
$table = factory(OutputDocument::class)->create();
$result = OutputDocument::getByOutDocUid($table->OUT_DOC_UID);
$this->assertNotEmpty($result);
}
}

View File

@@ -7,7 +7,7 @@ use ProcessMaker\Model\ProcessCategory;
use Tests\TestCase;
/**
* Class ProcessTest
* Class ProcessCategoryTest
*
* @coversDefaultClass \ProcessMaker\Model\ProcessCategory
*/
@@ -24,9 +24,25 @@ class ProcessCategoryTest extends TestCase
ProcessCategory::query()->delete();
}
/**
* Tests get categories
*
* @covers \ProcessMaker\Model\ProcessCategory::getCategories()
* @test
*/
public function it_tests_get_categories()
{
$processCategory = factory(ProcessCategory::class)->create();
$result = ProcessCategory::getCategories();
$this->assertNotEmpty($result);
}
/**
* Tests the getProcessCategories method without paremeters
*
* @covers \ProcessMaker\Model\ProcessCategory::getProcessCategories()
* @covers \ProcessMaker\Model\ProcessCategory::scopeCategoryName()
* @test
*/
public function it_tests_get_process_categories_method_without_paremeters()
@@ -51,6 +67,8 @@ class ProcessCategoryTest extends TestCase
/**
* Tests the getProcessCategories method filtered by name
*
* @covers \ProcessMaker\Model\ProcessCategory::getProcessCategories()
* @covers \ProcessMaker\Model\ProcessCategory::scopeCategoryName()
* @test
*/
public function it_tests_get_process_categories_method_filter_by_name()
@@ -79,6 +97,8 @@ class ProcessCategoryTest extends TestCase
/**
* Tests the getProcessCategories method with start and limit parameters
*
* @covers \ProcessMaker\Model\ProcessCategory::getProcessCategories()
* @covers \ProcessMaker\Model\ProcessCategory::scopeCategoryName()
* @test
*/
public function it_tests_get_process_categories_method_with_start_limit()
@@ -103,6 +123,7 @@ class ProcessCategoryTest extends TestCase
/**
* Tests the getCategoryId method
*
* @covers \ProcessMaker\Model\ProcessCategory::getCategoryId()
* @test
*/
public function it_tests_get_category_id_method()
@@ -112,4 +133,19 @@ class ProcessCategoryTest extends TestCase
$this->assertEquals($processCategory->CATEGORY_ID, $result);
}
/**
* Tests get category
*
* @covers \ProcessMaker\Model\ProcessCategory::getCategory()
* @covers \ProcessMaker\Model\ProcessCategory::scopeCategory()
* @test
*/
public function it_tests_get_category()
{
$processCategory = factory(ProcessCategory::class)->create();
$result = ProcessCategory::getCategory($processCategory->CATEGORY_ID);
$this->assertNotEmpty($result);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\ProcessUser;
use Tests\TestCase;
/**
* Class ProcessUserTest
*
* @coversDefaultClass \ProcessMaker\Model\ProcessUser
*/
class ProcessUserTest extends TestCase
{
use DatabaseTransactions;
/**
* Test get process of supervisor
*
* @covers \ProcessMaker\Model\ProcessUser::scopeProcessSupervisor()
* @covers \ProcessMaker\Model\ProcessUser::scopeProcessGroupSupervisor()
* @covers \ProcessMaker\Model\ProcessUser::scopeJoinProcess()
* @covers \ProcessMaker\Model\ProcessUser::getProcessesOfSupervisor()
* @test
*/
public function it_get_process_of_supervisor()
{
$table = factory(ProcessUser::class)->states('foreign_keys')->create();
$result = ProcessUser::getProcessesOfSupervisor($table->USR_UID);
$this->assertNotEmpty($result);
}
}

View File

@@ -7,7 +7,9 @@ use ProcessMaker\Model\ProcessVariables;
use Tests\TestCase;
/**
* @coversDefaultClass ProcessMaker\Model\ProcessVariables
* Class ProcessVariablesTest
*
* @coversDefaultClass \ProcessMaker\Model\ProcessVariables
*/
class ProcessVariablesTest extends TestCase
{

View File

@@ -9,7 +9,7 @@ use ProcessMaker\Model\RbacUsers;
use Tests\TestCase;
/**
* Class ProcessTest
* Class RbacUsersTest
*
* @coversDefaultClass \ProcessMaker\Model\SubProcess
*/

View File

@@ -0,0 +1,35 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\Step;
use Tests\TestCase;
/**
* Class StepTest
*
* @coversDefaultClass \ProcessMaker\Model\Step
*/
class StepTest extends TestCase
{
use DatabaseTransactions;
/**
* Test get specific step
*
* @covers \ProcessMaker\Model\Step::getByProcessTaskAndStepType()
* @test
*/
public function it_get_specific_step()
{
$table = factory(Step::class)->create();
$result = Step::getByProcessTaskAndStepType(
$table->PRO_UID,
$table->TAS_UID,
$table->STEP_TYPE_OBJ,
$table->STEP_UID_OBJ
);
$this->assertNotEmpty($result);
}
}

View File

@@ -8,7 +8,7 @@ use ProcessMaker\Model\SubProcess;
use Tests\TestCase;
/**
* Class ProcessTest
* Class SubProcessTest
*
* @coversDefaultClass \ProcessMaker\Model\SubProcess
*/

View File

@@ -9,7 +9,7 @@ use ProcessMaker\Model\Triggers;
use Tests\TestCase;
/**
* Class DelegationTest
* Class TriggersTest
*
* @coversDefaultClass \ProcessMaker\Model\Triggers
*/

View File

@@ -6,9 +6,13 @@ use G;
use ProcessMaker\Model\UserConfig;
use Tests\TestCase;
/**
* Class UserConfigTest
*
* @coversDefaultClass \ProcessMaker\Model\UserConfig
*/
class UserConfigTest extends TestCase
{
/**
* Setup method,
*/

View File

@@ -5,6 +5,11 @@ namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
use ListUnassigned as PropelListUnassigned;
/**
* Class ListUnassigned
*
* @deprecated Class deprecated in Release 3.6.0
*/
class ListUnassigned extends Model
{
protected $table = "LIST_UNASSIGNED";