/** * * @param JobCandidateAttachment $attachment * @return <type> */ public function saveCandidateAttachment(JobCandidateAttachment $attachment) { try { if ($attachment->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($attachment); $attachment->setId($idGenService->getNextID()); } $attachment->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * */ public function testSaveCandidateAttachmentForNullId() { TestDataService::truncateSpecificTables(array('JobCandidateAttachment')); $file = tmpfile(); fwrite($file, "writing to tempfile"); fseek($file, 0); $resume = new JobCandidateAttachment(); $resume->setId(null); $resume->setCandidateId(1); $resume->setFileName('xyz.txt'); $resume->setFileType('.txt'); $resume->setFileSize('512'); $return = $this->recruitmentAttachmentDao->saveCandidateAttachment($resume); $this->assertTrue($return); }