/** * Testing getCandidateList when Hiring manager, Candidate name and keywords are provided */ public function testGetCandidateListForHiringManagerCandidateAndKeywords() { $searchParam = new CandidateSearchParameters(); $searchParam->setHiringManagerId(1); $searchParam->setCandidateName('Yasitha Pandi'); $searchParam->setKeywords("java,oracle"); $candidateVacancyList = $this->candidateDao->searchCandidates($this->candidateDao->buildSearchQuery($searchParam)); $this->assertTrue($candidateVacancyList[0] instanceof CandidateSearchParameters); }
/** * Check that search works for a candidate name that has leading/trailing spaces (due to a bug in jobs.php). * UI will display the trimmed version and pass the trimmed version to the search function. * * eg: Name in DB (quoted here to show spaces): ' John ', ' D ', ' Conner' * search method gets 'John D Conner' and has to compare it with the values in the db. * */ public function testGetCandidateListForCandidateNameWithSpaces() { $searchParam = new CandidateSearchParameters(); $searchParam->setCandidateName('John Denis Connor'); $searchParam->setCandidateStatus(JobCandidate::ACTIVE); $searchQuery = $this->candidateDao->buildSearchQuery($searchParam); $candidateVacancyList = $this->candidateDao->searchCandidates($searchQuery); $this->assertEquals(1, count($candidateVacancyList)); $this->assertTrue($candidateVacancyList[0] instanceof CandidateSearchParameters); $this->assertEquals(11, $candidateVacancyList[0]->getCandidateId()); }
/** * * @param CandidateSearchParameters $searchParam * @return CandidateSearchParameters */ public function getSearchParamsBindwithFormData(CandidateSearchParameters $searchParam) { $searchParam->setJobTitleCode($this->getValue('jobTitle')); $searchParam->setVacancyId($this->getValue('jobVacancy')); $searchParam->setHiringManagerId($this->getValue('hiringManager')); $searchParam->setStatus($this->getValue('status')); $searchParam->setCandidateId($this->getValue('selectedCandidate')); $searchParam->setModeOfApplication($this->getValue('modeOfApplication')); $dateApplication = $this->getValue('dateApplication'); $searchParam->setFromDate($dateApplication['from']); $searchParam->setToDate($dateApplication['to']); $searchParam->setKeywords($this->getValue('keywords')); $searchParam->setCandidateName($this->getValue('candidateName')); return $searchParam; }
/** * Retriving candidates based on the search criteria * @param CandidateSearchParameters $searchParam * @return CandidateSearchParameters */ public function searchCandidates($searchCandidateQuery) { try { $pdo = Doctrine_Manager::connection()->getDbh(); $res = $pdo->query($searchCandidateQuery); $candidateList = $res->fetchAll(); $candidatesList = array(); foreach ($candidateList as $candidate) { $param = new CandidateSearchParameters(); $param->setVacancyName($candidate['name']); $param->setVacancyStatus($candidate['vacancyStatus']); $param->setCandidateId($candidate['id']); $param->setVacancyId($candidate['vacancyId']); $param->setCandidateName($candidate['first_name'] . " " . $candidate['middle_name'] . " " . $candidate['last_name'] . $this->_getCandidateNameSuffix($candidate['candidateStatus'])); $employeeName = $candidate['emp_firstname'] . " " . $candidate['emp_middle_name'] . " " . $candidate['emp_lastname']; $hmName = !empty($candidate['termination_id']) ? $employeeName . " (" . __("Past Employee") . ")" : $employeeName; $param->setHiringManagerName($hmName); $param->setDateOfApplication($candidate['date_of_application']); $param->setAttachmentId($candidate['attachmentId']); $param->setStatusName(ucwords(strtolower($candidate['status']))); $referralName = $candidate['ref_firstname'] . " " . $candidate['ref_middle_name'] . " " . $candidate['ref_lastname']; $param->setReferralName($referralName); $candidatesList[] = $param; } return $candidatesList; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }