seed(AssessmentTemplateSeeder::class); $expected = [ 'universal_intake', 'nihss', 'mrs', 'barthel', 'gcs', 'stroke_swallow', 'stroke_clinical', 'diabetes_core', 'outcome_core', 'heart_failure_core', 'ckd_core', 'hypertension_core', 'asthma_core', 'copd_core', 'dementia_core', 'parkinsons_core', 'cancer_core', 'pregnancy_core', 'orthopaedics_core', ]; foreach ($expected as $code) { $this->assertNotNull( AssessmentTemplate::currentSystemByCode($code), "Missing template {$code}" ); } } public function test_all_pathways_seed_with_required_bindings(): void { $this->seed(AssessmentTemplateSeeder::class); $this->seed(ClinicalPathwaySeeder::class); $expected = [ 'stroke', 'diabetes', 'heart_failure', 'ckd', 'hypertension', 'asthma', 'copd', 'dementia', 'parkinsons', 'cancer', 'pregnancy', 'orthopaedics', ]; foreach ($expected as $code) { $pathway = ClinicalPathway::findByCode($code); $this->assertNotNull($pathway, "Missing pathway {$code}"); $this->assertGreaterThanOrEqual( 1, $pathway->templates()->where('is_required_on_activation', true)->count(), "Pathway {$code} needs a required template" ); } } public function test_copd_and_heart_failure_scoring_templates(): void { $this->seed(AssessmentTemplateSeeder::class); $copd = AssessmentTemplate::currentSystemByCode('copd_core'); $hf = AssessmentTemplate::currentSystemByCode('heart_failure_core'); $this->assertSame('single_value', $copd->scoring_strategy); $this->assertSame('single_value', $hf->scoring_strategy); $this->assertTrue($copd->questions()->where('code', 'mmrc')->exists()); $this->assertTrue($hf->questions()->where('code', 'nyha')->exists()); } }