seedRolesAndPermissions(); $this->seed(ChecklistTemplateSeeder::class); } public function test_reminder_list_removes_consultant_after_submission(): void { $jpp = $this->makeUserWithRole('Pegawai JPP'); [$cUser, $consultant] = $this->makeConsultantUser(); $cycle = ReportingCycle::factory()->create(); $dc = DataCentre::factory()->create(['current_consultant_id' => $consultant->id]); // Pada mulanya pusat data muncul dalam senarai peringatan. $response = $this->actingAs($jpp)->get(route('reminders.index', ['cycle' => $cycle->id])); $response->assertOk(); $response->assertSee($dc->nama_pusat_data); // Perunding hantar serahan. $submission = Submission::create([ 'data_centre_id' => $dc->id, 'reporting_cycle_id' => $cycle->id, 'consultant_id' => $consultant->id, 'status' => 'baru', 'submitted_at' => now(), ]); // Selepas hantar, pusat data dikeluarkan daripada senarai peringatan. $response = $this->actingAs($jpp)->get(route('reminders.index', ['cycle' => $cycle->id])); $response->assertOk(); $response->assertDontSee($dc->nama_pusat_data); } public function test_draft_submission_still_appears_in_reminder_list(): void { $jpp = $this->makeUserWithRole('Pegawai JPP'); [$cUser, $consultant] = $this->makeConsultantUser(); $cycle = ReportingCycle::factory()->create(); $dc = DataCentre::factory()->create(['current_consultant_id' => $consultant->id]); // Hanya draf (belum hantar) — masih dalam senarai peringatan. app(SubmissionWorkflowService::class)->findOrCreateDraft($dc, $cycle); $response = $this->actingAs($jpp)->get(route('reminders.index', ['cycle' => $cycle->id])); $response->assertSee($dc->nama_pusat_data); } }