PMCORE-2636

This commit is contained in:
Paula Quispe
2020-12-22 15:21:08 -04:00
parent 1c36a18904
commit 9f77a4d106
5 changed files with 89 additions and 0 deletions

View File

@@ -86,6 +86,51 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
];
});
// Create a delegation with the foreign keys
$factory->state(\ProcessMaker\Model\Delegation::class, 'web_entry', function (Faker $faker) {
// Create values in the foreign key relations
$user = factory(\ProcessMaker\Model\User::class)->create();
$category = factory(\ProcessMaker\Model\ProcessCategory::class)->create();
$process = factory(\ProcessMaker\Model\Process::class)->create([
'PRO_CATEGORY' => $category->CATEGORY_UID,
'CATEGORY_ID' => $category->CATEGORY_ID
]);
$task = factory(\ProcessMaker\Model\Task::class)->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
$application = factory(\ProcessMaker\Model\Application::class)->states('web_entry')->create([
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID
]);
// Return with default values
return [
'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID,
'DEL_INDEX' => 1,
'APP_NUMBER' => $application->APP_NUMBER,
'DEL_PREVIOUS' => 0,
'PRO_UID' => $process->PRO_UID,
'TAS_UID' => $task->TAS_UID,
'USR_UID' => $user->USR_UID,
'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_INIT_DATE' => $faker->dateTime(),
'DEL_TASK_DUE_DATE' => $faker->dateTime(),
'DEL_RISK_DATE' => $faker->dateTime(),
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '',
'DEL_TITLE' => $faker->word()
];
});
// Create a open delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $faker) {
// Create dates with sense