This commit is contained in:
Your Name
2026-08-20 17:56:08 +08:00
parent 5794f60c5d
commit cc6173e5b0
393 changed files with 1320 additions and 1041 deletions
@@ -136,6 +136,18 @@ $trackingWindowMethod = diagnosisWorkspaceMethodSource(
$trackingWindowControllerMethod = diagnosisWorkspaceMethodSource(
(new ReflectionClass(DiagnosisController::class))->getMethod('trackingWindow')
);
$imChatControllerMethod = diagnosisWorkspaceMethodSource(
(new ReflectionClass(DiagnosisController::class))->getMethod('getImChatMessages')
);
$imChatSyncControllerMethod = diagnosisWorkspaceMethodSource(
(new ReflectionClass(DiagnosisController::class))->getMethod('triggerImChatSync')
);
$imChatLogicMethod = diagnosisWorkspaceMethodSource(
(new ReflectionClass(DiagnosisLogic::class))->getMethod('getImChatMessagesForDiagnosis')
);
$imChatOwnerMethod = diagnosisWorkspaceMethodSource(
(new ReflectionClass(DiagnosisLogic::class))->getMethod('attachDiagnosisIdToImMessages')
);
$doctorNotesControllerMethod = diagnosisWorkspaceMethodSource(
(new ReflectionClass(AppointmentController::class))->getMethod('doctorNotes')
);
@@ -195,6 +207,23 @@ diagnosisWorkspaceAuthExpect(
< strpos($trackingWindowMethod, "'blood_records'"),
'trackingWindow returns the authorized diagnosis id at the response top level'
);
diagnosisWorkspaceAuthExpect(
str_contains($imChatControllerMethod, 'DiagnosisLogic::canViewReadonlyDiagnosis(')
&& strpos($imChatControllerMethod, 'DiagnosisLogic::canViewReadonlyDiagnosis(')
< strpos($imChatControllerMethod, 'DiagnosisLogic::getImChatMessagesForDiagnosis('),
'IM history authorizes the diagnosis before reading patient messages'
);
diagnosisWorkspaceAuthExpect(
str_contains($imChatSyncControllerMethod, 'DiagnosisLogic::canViewReadonlyDiagnosis(')
&& strpos($imChatSyncControllerMethod, 'DiagnosisLogic::canViewReadonlyDiagnosis(')
< strpos($imChatSyncControllerMethod, 'register_shutdown_function('),
'IM archive sync authorizes the diagnosis before queuing background work'
);
diagnosisWorkspaceAuthExpect(
substr_count($imChatLogicMethod, 'attachDiagnosisIdToImMessages(') >= 3
&& str_contains($imChatOwnerMethod, "\$row['diagnosis_id'] = \$diagnosisId"),
'every IM response row declares its parent diagnosis for client-side ownership checks'
);
diagnosisWorkspaceAuthExpect(
str_contains($doctorNotesControllerMethod, 'DiagnosisLogic::canViewReadonlyDiagnosis(')
&& strpos($doctorNotesControllerMethod, 'DiagnosisLogic::canViewReadonlyDiagnosis(')