/**
  * Tests the update function in the OrganismController
  * @param  void
  * @return void
  */
 public function testUpdate()
 {
     $this->withoutMiddleware();
     $this->call('POST', '/organism', $this->organismData);
     $organismStored = Organism::orderBy('id', 'desc')->first();
     $this->withoutMiddleware();
     $this->call('PUT', '/organism/' . $organismStored->id, $this->organismDataUpdate);
     $organismSavedUpdated = Organism::find($organismStored->id);
     $this->assertEquals($organismSavedUpdated->name, $this->organismDataUpdate['name']);
     $this->assertEquals($organismSavedUpdated->description, $this->organismDataUpdate['description']);
     //Getting the drugs related to the organism
     /*$organismDrugUpdated = Organism::find($organismStored->id)->drugs->toArray();
     		
     		$this->assertEquals(12, $this->organismDataUpdate['drugs'][0]);*/
 }
Example #2
0
 /**
  * Remove the specified resource from storage (soft delete).
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     //Soft delete the organism
     $organism = Organism::find($id);
     /*$testCategoryInUse = TestType::where('test_category_id', '=', $id)->first();
     		if (empty($testCategoryInUse)) {
     		    // The test category is not in use
     			$testcategory->delete();
     		} else {
     		    // The test category is in use
     		    $url = session('SOURCE_URL');
                 
                 return Redirect::to($url)
     		    	->with('message', trans('terms.failure-test-category-in-use'));
     		}*/
     // redirect
     $url = session('SOURCE_URL');
     return redirect()->to($url)->with('message', trans('terms.record-successfully-deleted'));
 }