Skip to content

Commit

Permalink
tests: update existing cases tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devmiguelangel committed Oct 29, 2024
1 parent 1533e47 commit 430cca8
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 44 deletions.
1 change: 1 addition & 0 deletions ProcessMaker/Repositories/CaseSyncRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ private static function processTokens($instance, &$caseParticipatedData, &$caseS
'name' => $token->element_name,
'process_id' => $token->process_id,
'element_type' => $token->element_type,
'status' => $token->status,
];

$caseParticipatedData['processes'] = CaseUtils::storeProcesses($caseParticipatedData['processes'], $processData);
Expand Down
54 changes: 30 additions & 24 deletions tests/Feature/Cases/CaseParticipatedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,16 @@ public function test_create_multiple_case_participated()
'case_status' => 'IN_PROGRESS',
'request_tokens->[0]' => $token->id,
'request_tokens->[1]' => $token2->id,
'tasks->[0]->id' => $token->id,
'tasks->[0]->element_id' => $token->element_id,
'tasks->[0]->name' => $token->element_name,
'tasks->[0]->process_id' => $token->process_id,
'tasks->[1]->id' => $token2->id,
'tasks->[1]->element_id' => $token2->element_id,
'tasks->[1]->name' => $token2->element_name,
'tasks->[1]->process_id' => $token2->process_id,
'tasks->[0]->id' => $token2->id,
'tasks->[0]->element_id' => $token2->element_id,
'tasks->[0]->name' => $token2->element_name,
'tasks->[0]->process_id' => $token2->process_id,
'tasks->[0]->status' => $token2->status,
'tasks->[1]->id' => $token->id,
'tasks->[1]->element_id' => $token->element_id,
'tasks->[1]->name' => $token->element_name,
'tasks->[1]->process_id' => $token->process_id,
'tasks->[1]->status' => $token->status,
]);
}

Expand Down Expand Up @@ -264,14 +266,16 @@ public function test_update_case_participated_user_tasks()
'case_number' => $instance->case_number,
'request_tokens->[0]' => $token->id,
'request_tokens->[1]' => $token3->id,
'tasks->[0]->id' => $token->id,
'tasks->[0]->element_id' => $token->element_id,
'tasks->[0]->name' => $token->element_name,
'tasks->[0]->process_id' => $token->process_id,
'tasks->[1]->id' => $token3->id,
'tasks->[1]->element_id' => $token3->element_id,
'tasks->[1]->name' => $token3->element_name,
'tasks->[1]->process_id' => $token3->process_id,
'tasks->[0]->id' => $token3->id,
'tasks->[0]->element_id' => $token3->element_id,
'tasks->[0]->name' => $token3->element_name,
'tasks->[0]->process_id' => $token3->process_id,
'tasks->[0]->status' => $token3->status,
'tasks->[1]->id' => $token->id,
'tasks->[1]->element_id' => $token->element_id,
'tasks->[1]->name' => $token->element_name,
'tasks->[1]->process_id' => $token->process_id,
'tasks->[1]->status' => $token->status,
]);
}

Expand Down Expand Up @@ -345,14 +349,16 @@ public function test_update_case_participated_completed()
'case_status' => 'IN_PROGRESS',
'request_tokens->[0]' => $token->id,
'request_tokens->[1]' => $token3->id,
'tasks->[0]->id' => $token->id,
'tasks->[0]->element_id' => $token->element_id,
'tasks->[0]->name' => $token->element_name,
'tasks->[0]->process_id' => $token->process_id,
'tasks->[1]->id' => $token3->id,
'tasks->[1]->element_id' => $token3->element_id,
'tasks->[1]->name' => $token3->element_name,
'tasks->[1]->process_id' => $token3->process_id,
'tasks->[0]->id' => $token3->id,
'tasks->[0]->element_id' => $token3->element_id,
'tasks->[0]->name' => $token3->element_name,
'tasks->[0]->process_id' => $token3->process_id,
'tasks->[0]->status' => $token3->status,
'tasks->[1]->id' => $token->id,
'tasks->[1]->element_id' => $token->element_id,
'tasks->[1]->name' => $token->element_name,
'tasks->[1]->process_id' => $token->process_id,
'tasks->[1]->status' => $token->status,
]);

$instance->status = 'COMPLETED';
Expand Down
36 changes: 20 additions & 16 deletions tests/Feature/Cases/CaseStartedSubProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,16 @@ public function test_create_case_tasks()
'user_id' => $this->user->id,
'case_title' => $this->parentRequest->case_title,
'case_status' => 'IN_PROGRESS',
'tasks->[0]->id' => $this->parentToken->id,
'tasks->[0]->element_id' => $this->parentToken->element_id,
'tasks->[0]->name' => $this->parentToken->element_name,
'tasks->[0]->process_id' => $this->parentToken->process_id,
'tasks->[1]->id' => $this->childToken->id,
'tasks->[1]->element_id' => $this->childToken->element_id,
'tasks->[1]->name' => $this->childToken->element_name,
'tasks->[1]->process_id' => $this->childToken->process_id,
'tasks->[0]->id' => $this->childToken->id,
'tasks->[0]->element_id' => $this->childToken->element_id,
'tasks->[0]->name' => $this->childToken->element_name,
'tasks->[0]->process_id' => $this->childToken->process_id,
'tasks->[0]->status' => $this->childToken->status,
'tasks->[1]->id' => $this->parentToken->id,
'tasks->[1]->element_id' => $this->parentToken->element_id,
'tasks->[1]->name' => $this->parentToken->element_name,
'tasks->[1]->process_id' => $this->parentToken->process_id,
'tasks->[1]->status' => $this->parentToken->status,
]);
}

Expand Down Expand Up @@ -295,14 +297,16 @@ public function test_create_case_participated_tasks()
'user_id' => $this->user->id,
'case_title' => $this->parentRequest->case_title,
'case_status' => 'IN_PROGRESS',
'tasks->[0]->id' => $this->parentToken->id,
'tasks->[0]->element_id' => $this->parentToken->element_id,
'tasks->[0]->name' => $this->parentToken->element_name,
'tasks->[0]->process_id' => $this->parentToken->process_id,
'tasks->[1]->id' => $this->childToken->id,
'tasks->[1]->element_id' => $this->childToken->element_id,
'tasks->[1]->name' => $this->childToken->element_name,
'tasks->[1]->process_id' => $this->childToken->process_id,
'tasks->[0]->id' => $this->childToken->id,
'tasks->[0]->element_id' => $this->childToken->element_id,
'tasks->[0]->name' => $this->childToken->element_name,
'tasks->[0]->process_id' => $this->childToken->process_id,
'tasks->[0]->status' => $this->childToken->status,
'tasks->[1]->id' => $this->parentToken->id,
'tasks->[1]->element_id' => $this->parentToken->element_id,
'tasks->[1]->name' => $this->parentToken->element_name,
'tasks->[1]->process_id' => $this->parentToken->process_id,
'tasks->[1]->status' => $this->parentToken->status,
]);
$this->assertDatabaseHas('cases_participated', [
'case_number' => $this->parentRequest->case_number,
Expand Down
10 changes: 6 additions & 4 deletions tests/Feature/Cases/CaseStartedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public function test_update_case_started_tasks()
'tasks->[0]->element_id' => $token->element_id,
'tasks->[0]->name' => $token->element_name,
'tasks->[0]->process_id' => $token->process_id,
'tasks->[0]->status' => $token->status,
]);

$token2 = ProcessRequestToken::factory()->create([
Expand All @@ -201,10 +202,11 @@ public function test_update_case_started_tasks()
'user_id' => $user->id,
'case_title' => $instance->case_title,
'case_status' => 'IN_PROGRESS',
'tasks->[1]->id' => $token2->id,
'tasks->[1]->element_id' => $token2->element_id,
'tasks->[1]->name' => $token2->element_name,
'tasks->[1]->process_id' => $token2->process_id,
'tasks->[0]->id' => $token2->id,
'tasks->[0]->element_id' => $token2->element_id,
'tasks->[0]->name' => $token2->element_name,
'tasks->[0]->process_id' => $token2->process_id,
'tasks->[0]->status' => $token2->status,
]);
}

Expand Down

0 comments on commit 430cca8

Please sign in to comment.