40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
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 - Passed
|
|
public function testShowNotFound() {
|
|
$result = $this->get($this->endpoint . '/90909090');
|
|
$result->assertStatus(200);
|
|
$result->assertJSONFragment([
|
|
'status' => 'success',
|
|
"message" => "data not found."
|
|
]);
|
|
}
|
|
|
|
// 200 ok found - Passed
|
|
public function testShowSingleRow() {
|
|
// Pastikan DB test punya seed patient InternalPID=10 tanpa id/addr
|
|
$result = $this->get($this->endpoint . '/1');
|
|
|
|
$data = $result->getJSON(true);
|
|
$data = json_decode($data, true);
|
|
|
|
$result->assertStatus(200);
|
|
$result->assertArrayHasKey('data', $data);
|
|
$result->assertIsArray($data['data']);
|
|
|
|
// $this->assertEquals('success', $data['status']);
|
|
}
|
|
|
|
}
|