public function testStore()
 {
     echo "\n\nTEST SPECIMEN REJECTION CONTROLLER TEST\n\n";
     $this->withoutMiddleware();
     // Store the Rejection Reason
     $this->call('POST', '/specimenrejection', $this->rejectionReasonData);
     $rejectionReasonstored = RejectionReason::orderBy('id', 'desc')->first();
     $rejectionReasonSaved = RejectionReason::find($rejectionReasonstored->id);
     $this->assertEquals($rejectionReasonSaved->reason, $this->rejectionReasonData['reason']);
 }
Example #2
0
 /**
  * Remove the specified resource from storage (soft delete).
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     //Soft delete the rejection
     $rejection = RejectionReason::find($id);
     $inUseBySpecimen = $rejection->specimen->toArray();
     try {
         // The rejection is not in use
         $rejection->delete();
     } catch (Exception $e) {
         // The rejection is in use
         $url = session('SOURCE_URL');
         return redirect()->to($url)->with('message', trans('terms.failure-delete-record'));
     }
     // redirect
     $url = session('SOURCE_URL');
     return redirect()->to($url)->with('message', trans('terms.record-successfully-deleted'));
 }
 /**
  * Remove the specified resource from storage (soft delete).
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //Soft delete the rejection
     $rejection = RejectionReason::find($id);
     $inUseBySpecimen = $rejection->specimen->toArray();
     try {
         // The rejection is not in use
         $rejection->delete();
     } catch (Exception $e) {
         // The rejection is in use
         $url = session('SOURCE_URL');
         return redirect()->to($url)->with('message', trans('messages.failure-specimen-rejection-reason-in-use'));
     }
     // redirect
     $url = session('SOURCE_URL');
     return redirect()->to($url)->with('message', trans('messages.success-deleting-rejection-reason'));
 }