clqms-be/tests/feature/PatVisit/PatVisitShowTest.php
root 2bcdf09b55 chore: repo-wide normalization + rules test coverage
Normalize formatting/line endings across configs, controllers, models, tests, and OpenAPI specs.

Update rule expression/rule engine implementation and remove obsolete RuleAction controller/model.

Add unit tests for rule expression syntax and multi-action behavior, and include docs updates.
2026-03-16 07:24:50 +07:00

52 lines
1.2 KiB
PHP

<?php
namespace Tests\Feature\PatVisit;
use CodeIgniter\Test\FeatureTestTrait;
use CodeIgniter\Test\CIUnitTestCase;
class PatVisitShowTest extends CIUnitTestCase
{
use FeatureTestTrait;
protected $endpoint = 'api/patvisit';
public function testShowPatientVisitSuccess()
{
$PVID = '1';
$response = $this->get($this->endpoint .'/'. $PVID);
$response->assertStatus(200);
$response->assertJSONFragment([
'status' => 'success',
'message' => 'data not found',
]);
$json = json_decode($response->getJSON(), true);
$this->assertArrayHasKey('data', $json);
$this->assertIsArray($json['data']);
}
/**
* Test: Show patient visit with invalid/nonexistent PVID
*/
public function testShowPatientVisitNotFound()
{
$invalidPVID = '99999';
$response = $this->get($this->endpoint .'/'. $invalidPVID);
$response->assertStatus(200);
$json = json_decode($response->getJSON(), true);
$this->assertArrayHasKey('data', $json);
$this->assertIsArray($json['data']);
$this->assertCount(0, $json['data']); // harus kosong
}
}