Files
ladill-care/tests/Feature/CareContentPacksTest.php
T
isaacclad 2ce4bc8993
Deploy Ladill Care / deploy (push) Successful in 1m26s
feat(assessments): layered clinical assessment engine end-to-end
Add a template-driven assessment system with universal intake, clinical
pathways, disease instruments (stroke MVP + extended, diabetes, and ten
specialty packs), scoring, patient outcome trends, REST/API + FHIR
export, and Enterprise org-level assessment analytics. Seed packs and
design/licensing docs ship for deploy and pre-GA review.
2026-07-16 22:58:09 +00:00

95 lines
2.7 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\AssessmentTemplate;
use App\Models\ClinicalPathway;
use Database\Seeders\AssessmentTemplateSeeder;
use Database\Seeders\ClinicalPathwaySeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
/** PR 10 — additional specialty content packs seed cleanly. */
class CareContentPacksTest extends TestCase
{
use RefreshDatabase;
public function test_all_core_assessment_packs_seed(): void
{
$this->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());
}
}