clqms-be/tests/feature/Patients/PatientShowTest.php
2025-09-25 14:01:33 +07:00

39 lines
1010 B
PHP

<?php
namespace Tests\Feature\Patients;
use CodeIgniter\Test\FeatureTestTrait;
use CodeIgniter\Test\CIUnitTestCase;
class PatientShowTest extends CIUnitTestCase
{
use FeatureTestTrait;
protected $endpoint = 'api/patient';
// 200 ok not found
public function testShowNotFound() {
$result = $this->get($this->endpoint . '/90909090');
$result->assertStatus(200);
$result->assertJSONFragment([
'status' => 'success',
"message" => "Patient with ID 90909090 not found.",
'data' => []
]);
}
// 200 ok
public function testShowSingleRow() {
// Pastikan DB test punya seed patient InternalPID=10 tanpa id/addr
$result = $this->get($this->endpoint . '/1');
$result->assertStatus(200);
$data = $result->getJSON(true);
$data = json_decode($data, true);
$this->assertEquals('success', $data['status']);
// $this->assertNull($data['data']['Attachments']);
}
}