/** * @test delete */ public function testDeleteTelefone() { $telefone = $this->makeTelefone(); $resp = $this->telefoneRepo->delete($telefone->id); $this->assertTrue($resp); $this->assertNull(Telefone::find($telefone->id), 'Telefone should not exist in DB'); }
/** * @param int $id * @return Response * * @SWG\Delete( * path="/telefones/{id}", * summary="Remove the specified Telefone from storage", * tags={"Telefone"}, * description="Delete Telefone", * produces={"application/json"}, * @SWG\Parameter( * name="id", * description="id of Telefone", * 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 Telefone $telefone */ $telefone = $this->telefoneRepository->find($id); if (empty($telefone)) { return Response::json(ResponseUtil::makeError('Telefone not found'), 404); } $telefone->delete(); return $this->sendResponse($id, 'Telefone deleted successfully'); }