PMC-604
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
use Faker\Generator as Faker;
|
||||
use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
|
||||
$factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
|
||||
$app = factory(\ProcessMaker\Model\Application::class)->create();
|
||||
@@ -14,6 +13,8 @@ $factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
|
||||
} else{
|
||||
$user = $users->random();
|
||||
}
|
||||
|
||||
// Return with default values
|
||||
return [
|
||||
'APP_UID' => $app->APP_UID,
|
||||
'DEL_INDEX' => 1,
|
||||
@@ -35,4 +36,41 @@ $factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_DATA' => ''
|
||||
];
|
||||
});
|
||||
});
|
||||
|
||||
// Create a open delegation
|
||||
$factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $faker) {
|
||||
// Create dates with sense
|
||||
$delegateDate = $faker->dateTime();
|
||||
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
|
||||
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
|
||||
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day');
|
||||
|
||||
return [
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_DELEGATE_DATE' => $delegateDate,
|
||||
'DEL_INIT_DATE' => $initDate,
|
||||
'DEL_RISK_DATE' => $riskDate,
|
||||
'DEL_TASK_DUE_DATE' => $taskDueDate,
|
||||
'DEL_FINISH_DATE' => null
|
||||
];
|
||||
});
|
||||
|
||||
// Create a closed delegation
|
||||
$factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker $faker) {
|
||||
// Create dates with sense
|
||||
$delegateDate = $faker->dateTime();
|
||||
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
|
||||
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
|
||||
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day');
|
||||
$finishDate = $faker->dateTimeInInterval($initDate, '+10 days');
|
||||
|
||||
return [
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'DEL_DELEGATE_DATE' => $delegateDate,
|
||||
'DEL_INIT_DATE' => $initDate,
|
||||
'DEL_RISK_DATE' => $riskDate,
|
||||
'DEL_TASK_DUE_DATE' => $taskDueDate,
|
||||
'DEL_FINISH_DATE' => $finishDate
|
||||
];
|
||||
});
|
||||
|
||||
@@ -1052,25 +1052,18 @@ class DelegationTest extends TestCase
|
||||
*/
|
||||
public function it_should_return_participation_info()
|
||||
{
|
||||
// Initializing Faker instance
|
||||
$faker = Faker\Factory::create();
|
||||
|
||||
// Creating one application with two delegations
|
||||
factory(User::class, 100)->create();
|
||||
$process = factory(Process::class)->create();
|
||||
$application = factory(Application::class)->create([
|
||||
'APP_UID' => G::generateUniqueID()
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'DEL_FINISH_DATE' => $faker->dateTime()
|
||||
factory(Delegation::class)->states('closed')->create([
|
||||
'APP_UID' => $application->APP_UID
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
factory(Delegation::class)->states('open')->create([
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'DEL_INDEX' => 2,
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'DEL_FINISH_DATE' => $faker->dateTime()
|
||||
'DEL_INDEX' => 2
|
||||
]);
|
||||
|
||||
// Check the information returned
|
||||
|
||||
Reference in New Issue
Block a user