修复
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
use app\adminapi\validate\tcm\DiagnosisValidate;
|
||||
|
||||
$checks = 0;
|
||||
// Lang::has uses its local dictionary only. No application constructor or bootstrap.
|
||||
$unbootedApp = (new ReflectionClass(think\App::class))->newInstanceWithoutConstructor();
|
||||
$tasks = ['summary', 'case_analysis', 'glucose_trend', 'lifestyle_advice', 'tcm_pattern',
|
||||
'prescription_review', 'prescription_generate', 'medication_review', 'exam_review',
|
||||
'complication_risk', 'guideline_review', 'custom'];
|
||||
foreach ($tasks as $task) {
|
||||
$validator = new DiagnosisValidate();
|
||||
$validator->setLang(new think\Lang($unbootedApp));
|
||||
if (!$validator->only(['task'])->check(['task' => $task])) throw new RuntimeException('Expected supported task: ' . $task);
|
||||
++$checks;
|
||||
}
|
||||
foreach (['', 'source_only', 'glucose_trend,custom', 'CUSTOM', '<script>'] as $task) {
|
||||
$validator = new DiagnosisValidate();
|
||||
$validator->setLang(new think\Lang($unbootedApp));
|
||||
if ($validator->only(['task'])->check(['task' => $task])) throw new RuntimeException('Unexpected task accepted');
|
||||
++$checks;
|
||||
}
|
||||
echo json_encode(['passed' => $checks, 'scope' => 'actual task validator only; diagnosis authorization and database not invoked']) . "\n";
|
||||
Reference in New Issue
Block a user