call('get', 'api/patient/999999'); // ID yang tidak ada $result->assertStatus(200); $json = $result->getJSON(); // bentuk string JSON $json = json_decode($json, true); // $this->assertSame('Patient with ID 999999 not found.', $json['message']); $result->assertJSONFragment([ 'status' => 'success', 'data' => [] ]); } public function testShowFound() { $result = $this->call('get', 'api/patient/1'); // ID yang tidak ada $result->assertStatus(200); $json = $result->getJSON(); $data = json_decode($json, true); $this->assertEquals('success', $data['status']); $this->assertNotNull($data['data']); // data tidak null $this->assertIsArray($data['data']); // data berupa array } }