From 7472364002ed2a279e5f28ac8c8dbf2075825ff0 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Thu, 8 Oct 2026 20:56:59 +0530 Subject: [PATCH] chore: remove test command after verification --- app/Commands/TestAbdmPdf.php | 70 ------------------------------------ 1 file changed, 70 deletions(-) delete mode 100644 app/Commands/TestAbdmPdf.php diff --git a/app/Commands/TestAbdmPdf.php b/app/Commands/TestAbdmPdf.php deleted file mode 100644 index 0ca4739..0000000 --- a/app/Commands/TestAbdmPdf.php +++ /dev/null @@ -1,70 +0,0 @@ - 'Patient ID to test (default 15350)', - 'consent_request_id' => 'Optional consent request ID filter', - ]; - - public function run(array $params) - { - $patientId = (int) ($params[0] ?? 15350); - $consentReqId = (string) ($params[1] ?? ''); - - CLI::write("Testing ABDM PDF generation for patient: {$patientId}", 'yellow'); - - $_SERVER['REQUEST_METHOD'] = 'GET'; - $get = []; - if ($consentReqId !== '') { - if (is_numeric($consentReqId) && strlen($consentReqId) < 10) { - $get['doc_id'] = (int) $consentReqId; - } else { - $get['consent_request_id'] = $consentReqId; - } - } - $_GET = $get; - - $request = \Config\Services::request(null, false); - $request->setGlobal('get', $get); - \Config\Services::injectMock('request', $request); - - $controller = new \App\Controllers\Patient(); - $response = \Config\Services::response(); - $logger = service('logger'); - $controller->initController($request, $response, $logger); - - $startTime = microtime(true); - $res = $controller->abdm_records_pdf($patientId); - $duration = round((microtime(true) - $startTime) * 1000, 2); - - $status = $res->getStatusCode(); - $contentType = $res->getHeaderLine('Content-Type'); - $disposition = $res->getHeaderLine('Content-Disposition'); - $body = $res->getBody(); - $len = strlen($body); - - CLI::write("Status: {$status}", $status === 200 ? 'green' : 'red'); - CLI::write("Content-Type: {$contentType}"); - CLI::write("Disposition: {$disposition}"); - CLI::write("PDF Size: {$len} bytes (generated in {$duration} ms)"); - - if (str_starts_with($body, '%PDF-')) { - CLI::write("VALID PDF HEADER: " . substr($body, 0, 8), 'green'); - $outPath = WRITEPATH . 'cache/test_abdm_records.pdf'; - file_put_contents($outPath, $body); - CLI::write("Saved test PDF to: {$outPath}", 'green'); - } else { - CLI::write("ERROR: Output is not a valid PDF: " . substr($body, 0, 200), 'red'); - } - } -}