PMC-604
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
use Faker\Generator as Faker;
|
use Faker\Generator as Faker;
|
||||||
use ProcessMaker\BusinessModel\Cases as BmCases;
|
|
||||||
|
|
||||||
$factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
|
$factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
|
||||||
$app = factory(\ProcessMaker\Model\Application::class)->create();
|
$app = factory(\ProcessMaker\Model\Application::class)->create();
|
||||||
@@ -14,6 +13,8 @@ $factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
|
|||||||
} else{
|
} else{
|
||||||
$user = $users->random();
|
$user = $users->random();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return with default values
|
||||||
return [
|
return [
|
||||||
'APP_UID' => $app->APP_UID,
|
'APP_UID' => $app->APP_UID,
|
||||||
'DEL_INDEX' => 1,
|
'DEL_INDEX' => 1,
|
||||||
@@ -35,4 +36,41 @@ $factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
|
|||||||
'TAS_ID' => $task->TAS_ID,
|
'TAS_ID' => $task->TAS_ID,
|
||||||
'DEL_DATA' => ''
|
'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()
|
public function it_should_return_participation_info()
|
||||||
{
|
{
|
||||||
// Initializing Faker instance
|
|
||||||
$faker = Faker\Factory::create();
|
|
||||||
|
|
||||||
// Creating one application with two delegations
|
// Creating one application with two delegations
|
||||||
factory(User::class, 100)->create();
|
factory(User::class, 100)->create();
|
||||||
$process = factory(Process::class)->create();
|
$process = factory(Process::class)->create();
|
||||||
$application = factory(Application::class)->create([
|
$application = factory(Application::class)->create([
|
||||||
'APP_UID' => G::generateUniqueID()
|
'APP_UID' => G::generateUniqueID()
|
||||||
]);
|
]);
|
||||||
factory(Delegation::class)->create([
|
factory(Delegation::class)->states('closed')->create([
|
||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID
|
||||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
|
||||||
'DEL_FINISH_DATE' => $faker->dateTime()
|
|
||||||
]);
|
]);
|
||||||
factory(Delegation::class)->create([
|
factory(Delegation::class)->states('open')->create([
|
||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
'DEL_INDEX' => 2,
|
'DEL_INDEX' => 2
|
||||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
|
||||||
'DEL_FINISH_DATE' => $faker->dateTime()
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Check the information returned
|
// Check the information returned
|
||||||
|
|||||||
Reference in New Issue
Block a user