withBodyFormat('json') // ->delete($this->endpoint, []); // $result->assertStatus(500); // $result->assertJSONFragment([ // 'status' => 500, // 'messages' => [ // 'error' => 'Internal server error: Undefined array key "InternalPID"' // ] // ]); // } // // 400 // public function testDeleteWitWrongInternalPID() { // $result = $this->withBodyFormat('json') // ->delete($this->endpoint, [ // // Pilih salah satu // // 'InternalPID' => [], // // 'InternalPID' => 0, // // 'InternalPID' => '0', // // 'InternalPID' => '', // 'InternalPID' => null, // ]); // $result->assertStatus(400); // $result->assertJSONFragment([ // 'status' => 'error', // 'message' => 'Patient ID must be a valid integer.' // ]); // } // // 404 not found // public function testDeleteNotFound() { // $testId = 9999; // $result = $this->withBodyFormat('json') // ->delete($this->endpoint, [ // 'InternalPID' => $testId // ]); // $result->assertStatus(404); // $result->assertJSONFragment([ // 'status' => 404, // 'error' => 404, // 'messages' => [ // 'error' => 'Patient ID with '.$testId.' not found.' // ] // ]); // } // // 200 ok // public function testDeleteSuccess() { // $testId = 3; // // Anggap patient 1 2 3 ada di seed DB // $result = $this->withBodyFormat('json') // ->delete($this->endpoint, [ // 'InternalPID' => $testId // ]); // $result->assertStatus(200); // $result->assertJSONFragment([ // 'status' => 'success', // 'message' => 'Patient ID with '.$testId.' deleted successfully.' // ]); // } // // 400 - SQL Inject // public function testDeleteServerError() { // // Simulasi: kirim input aneh yang trigger exception // $result = $this->withBodyFormat('json') // ->delete($this->endpoint, [ // 'InternalPID' => "' OR 1=1 --" // ]); // $result->assertStatus(400); // $result->assertJSONFragment([ // 'status' => 'error', // 'message' => 'Patient ID must be a valid integer.' // ]); // } }