/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if ($id == null) { return null; } Plant::find($id)->delete(); return $id; }
public function testShowPlant() { $plantController = new \App\Http\Controllers\plantController(); $id = \App\Plant::where("name", "like", 'Test plant')->first()->id; $plant1 = $plantController->show($id); $plant2 = \App\Plant::find($id); $this->assertEquals($plant1, $plant2); $this->assertNull($plantController->show(null)); }