/** * @test delete */ public function testDeleteEndereco() { $endereco = $this->makeEndereco(); $resp = $this->enderecoRepo->delete($endereco->id); $this->assertTrue($resp); $this->assertNull(Endereco::find($endereco->id), 'Endereco should not exist in DB'); }
/** * @param int $id * @return Response * * @SWG\Delete( * path="/enderecos/{id}", * summary="Remove the specified Endereco from storage", * tags={"Endereco"}, * description="Delete Endereco", * produces={"application/json"}, * @SWG\Parameter( * name="id", * description="id of Endereco", * type="integer", * required=true, * in="path" * ), * @SWG\Response( * response=200, * description="successful operation", * @SWG\Schema( * type="object", * @SWG\Property( * property="success", * type="boolean" * ), * @SWG\Property( * property="data", * type="string" * ), * @SWG\Property( * property="message", * type="string" * ) * ) * ) * ) */ public function destroy($id) { /** @var Endereco $endereco */ $endereco = $this->enderecoRepository->find($id); if (empty($endereco)) { return Response::json(ResponseUtil::makeError('Endereco not found'), 404); } $endereco->delete(); return $this->sendResponse($id, 'Endereco deleted successfully'); }