Add consultation-nested assessment create and show routes.
Deploy Ladill Care / deploy (push) Successful in 32s
Deploy Ladill Care / deploy (push) Successful in 32s
Index alone still left /consultations/{uuid}/assessments/create and
/consultations/{uuid}/assessments/{uuid} unmatched (404). Wire those
paths, redirect store into the nested show, and cover the doctor form
open flow with feature tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -400,6 +400,76 @@ class CareAssessmentCaptureTest extends TestCase
|
||||
$this->assertSame($this->branch->id, $assessment->branch_id);
|
||||
}
|
||||
|
||||
public function test_consultation_create_show_and_store_open_forms_for_doctor(): void
|
||||
{
|
||||
$this->setMemberRole('doctor');
|
||||
|
||||
$visit = Visit::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'status' => Visit::STATUS_OPEN,
|
||||
'checked_in_at' => now(),
|
||||
]);
|
||||
|
||||
$consultation = Consultation::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'visit_id' => $visit->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'status' => Consultation::STATUS_DRAFT,
|
||||
'started_at' => now(),
|
||||
]);
|
||||
|
||||
// Nested create (was unmatched → Laravel 404 before this fix)
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.consultations.assessments.create', $consultation))
|
||||
->assertOk()
|
||||
->assertSee('Start assessment')
|
||||
->assertSee('Universal Intake');
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get('/consultations/'.$consultation->uuid.'/assessments/create')
|
||||
->assertOk();
|
||||
|
||||
$response = $this->actingAs($this->user)
|
||||
->post(route('care.consultations.assessments.store', $consultation), [
|
||||
'template_code' => 'universal_intake',
|
||||
]);
|
||||
|
||||
$assessment = Assessment::first();
|
||||
$this->assertNotNull($assessment);
|
||||
|
||||
$response->assertRedirect(route('care.consultations.assessments.show', [
|
||||
'consultation' => $consultation,
|
||||
'assessment' => $assessment,
|
||||
]));
|
||||
|
||||
// Nested show (was unmatched → Laravel 404)
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.consultations.assessments.show', [$consultation, $assessment]))
|
||||
->assertOk()
|
||||
->assertSee('Universal Intake')
|
||||
->assertSee('Back to consultation');
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get('/consultations/'.$consultation->uuid.'/assessments/'.$assessment->uuid)
|
||||
->assertOk();
|
||||
|
||||
// Flat show still works for patient-chart / bookmarks
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.assessments.show', $assessment))
|
||||
->assertOk();
|
||||
|
||||
// Patient create + store with consultation_uuid also lands on nested show
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.assessments.create', [
|
||||
'patient' => $this->patient,
|
||||
'consultation_uuid' => $consultation->uuid,
|
||||
]))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_public_bodies_use_consultation_uuid(): void
|
||||
{
|
||||
$this->setMemberRole('doctor');
|
||||
@@ -430,6 +500,10 @@ class CareAssessmentCaptureTest extends TestCase
|
||||
|
||||
$assessment = Assessment::first();
|
||||
$this->assertSame($consultation->id, $assessment->consultation_id);
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.consultations.assessments.show', [$consultation, $assessment]))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_tenant_isolation_returns_404(): void
|
||||
|
||||
Reference in New Issue
Block a user