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 } }