get($this->endpoint . '/' . $InternalPID); $response->assertStatus(200); // Pastikan JSON berisi struktur dasar $response->assertJSONFragment([ 'status' => 'success', // 'message' => 'data not found', ]); $json = json_decode($response->getJSON(), true); // Pastikan 'data' ada $this->assertArrayHasKey('data', $json); $this->assertIsArray($json['data']); } /** * Test: Show by patient with invalid / nonexistent InternalPID */ public function testShowByPatientNotFound() { $invalidPID = 9999999; // diasumsikan tidak ada $response = $this->get($this->endpoint . '/' . $invalidPID); $response->assertStatus(200); $json = json_decode($response->getJSON(), true); $this->assertArrayHasKey('data', $json); $this->assertIsArray($json['data']); $this->assertCount(0, $json['data']); // Data kosong } }