clqms-be/tests/feature/Patients/PatientCreateTest.php
2025-09-23 10:18:48 +07:00

79 lines
2.4 KiB
PHP

<?php
namespace Tests\Feature\Patient;
use CodeIgniter\Test\FeatureTestTrait;
use CodeIgniter\Test\CIUnitTestCase;
class PatientCreateTest extends CIUnitTestCase
{
use FeatureTestTrait;
// public function testCreatePatientValidationFail()
// {
// // error 400 yg diharapkan
// $payload = ['Name' => 'Ngawur'];
// $result = $this->withBodyFormat('json')
// ->call('post', 'api/patient', $payload);
// $result->assertStatus(400);
// $result->assertJSONFragment([
// 'status' => 'error'
// ]);
// // Kondisi Jika PatiD Sama
// $payload = [
// "PatientID"=> "SMAJ1",
// "AlternatePID"=> "ALT001234",
// "Prefix"=> "Mr.",
// "NameFirst"=> "Budi",
// "NameMiddle"=> "Santoso",
// "NameMaiden"=> "Kiki",
// "NameLast"=> "Wijaya",
// "Suffix"=> "S.kom",
// "NameAlias"=> "Bud",
// "Gender"=> "1",
// ];
// $result = $this->withBodyFormat('json')
// ->call('post', 'api/patient', $payload);
// $result->assertStatus(400);
// $result->assertJSONFragment([
// 'status' => 'error',
// "message" => "Validation failed (patient)",
// ]);
// }
// // Wajib Diganti ya payloadnya kalau mau dijalankan
// public function testCreateSuccess()
// {
// $payload = [
// "PatientID"=> "SMAJ6", //Wajib Ganti
// "AlternatePID"=> "P0234",
// "Prefix"=> "Mr.",
// "NameFirst"=> "Budi",
// "NameMiddle"=> "Santoso",
// "NameMaiden"=> "Kiki",
// "NameLast"=> "Wijaya",
// "Suffix"=> "S.kom",
// "NameAlias"=> "Bud",
// "Gender"=> "1",
// 'EmailAddress1' => 'kaka@gmail.a1com', //Wajib Ganti
// 'Identity' => [
// "IdentifierType" => "KTP",
// "Identifier" => "317409050590100" //Wajib Ganti
// ]
// ];
// // $result = $this->call('post', 'api/patient', $payload);
// $result = $this->withBodyFormat('json')
// ->call('post', 'api/patient', $payload);
// $result->assertStatus(201);
// $result->assertJSONFragment([
// 'status' => 'success',
// ]);
// }
}