diff --git a/tests/Feature/Api/UsersTest.php b/tests/Feature/Api/UsersTest.php index c5d343e519..dc04cabb43 100644 --- a/tests/Feature/Api/UsersTest.php +++ b/tests/Feature/Api/UsersTest.php @@ -819,31 +819,28 @@ public function testGetUsersTaskCount() $process = Process::factory()->create([ 'user_id' => $admin->id, ]); - $request = ProcessRequest::factory()->create([ - 'process_id' => $process->id, - 'user_id' => $admin->id, - ]); - // Assign user to node_1 - ProcessTaskAssignment::factory()->create([ - 'process_id' => $process->id, - 'process_task_id' => 'node_1', - 'assignment_type' => User::class, - 'assignment_id' => $user->id, - ]); + $bpmn = file_get_contents(__DIR__ . '/../../fixtures/task_with_user_group_assignment.bpmn'); + $bpmn = str_replace([ + '[assigned-users]', + '[assigned-groups]', + ], [ + $user->id, + $group->id, + ], $bpmn); + + $process->bpmn = $bpmn; // Save separately from factory::create to utilize ProcessTaskAssignmentsTrait + $process->save(); - // Assign group to node_1 - ProcessTaskAssignment::factory()->create([ + $request = ProcessRequest::factory()->create([ 'process_id' => $process->id, - 'process_task_id' => 'node_1', - 'assignment_type' => Group::class, - 'assignment_id' => $group->id, + 'user_id' => $admin->id, ]); $tasks = ProcessRequestToken::factory(3)->create([ 'process_id' => $process->id, 'process_request_id' => $request->id, - 'element_id' => 'node_1', + 'element_id' => 'node_2', 'user_id' => $user->id, 'status' => 'ACTIVE', ]); diff --git a/tests/Fixtures/task_with_user_group_assignment.bpmn b/tests/Fixtures/task_with_user_group_assignment.bpmn new file mode 100644 index 0000000000..9dea6f7124 --- /dev/null +++ b/tests/Fixtures/task_with_user_group_assignment.bpmn @@ -0,0 +1,38 @@ + + + + + node_13 + + + node_13 + node_22 + + + node_22 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file