/** * @test update */ public function testUpdateSysAreaAtuacao() { $sysAreaAtuacao = $this->makeSysAreaAtuacao(); $fakeSysAreaAtuacao = $this->fakeSysAreaAtuacaoData(); $updatedSysAreaAtuacao = $this->sysAreaAtuacaoRepo->update($fakeSysAreaAtuacao, $sysAreaAtuacao->id); $this->assertModelData($fakeSysAreaAtuacao, $updatedSysAreaAtuacao->toArray()); $dbSysAreaAtuacao = $this->sysAreaAtuacaoRepo->find($sysAreaAtuacao->id); $this->assertModelData($fakeSysAreaAtuacao, $dbSysAreaAtuacao->toArray()); }
/** * @param int $id * @param UpdateSysAreaAtuacaoAPIRequest $request * @return Response * * @SWG\Put( * path="/sysAreaAtuacaos/{id}", * summary="Update the specified SysAreaAtuacao in storage", * tags={"SysAreaAtuacao"}, * description="Update SysAreaAtuacao", * produces={"application/json"}, * @SWG\Parameter( * name="id", * description="id of SysAreaAtuacao", * type="integer", * required=true, * in="path" * ), * @SWG\Parameter( * name="body", * in="body", * description="SysAreaAtuacao that should be updated", * required=false, * @SWG\Schema(ref="#/definitions/SysAreaAtuacao") * ), * @SWG\Response( * response=200, * description="successful operation", * @SWG\Schema( * type="object", * @SWG\Property( * property="success", * type="boolean" * ), * @SWG\Property( * property="data", * ref="#/definitions/SysAreaAtuacao" * ), * @SWG\Property( * property="message", * type="string" * ) * ) * ) * ) */ public function update($id, UpdateSysAreaAtuacaoAPIRequest $request) { $input = $request->all(); /** @var SysAreaAtuacao $sysAreaAtuacao */ $sysAreaAtuacao = $this->sysAreaAtuacaoRepository->find($id); if (empty($sysAreaAtuacao)) { return Response::json(ResponseUtil::makeError('SysAreaAtuacao not found'), 404); } $sysAreaAtuacao = $this->sysAreaAtuacaoRepository->update($input, $id); return $this->sendResponse($sysAreaAtuacao->toArray(), 'SysAreaAtuacao updated successfully'); }