Exemplo n.º 1
0
 /**
  * @param array    $data
  * @param Campaign $campaign
  *
  * @return Response
  */
 public function createResponse(array $data, Campaign $campaign)
 {
     $response = new Response();
     $response->setCampaign($campaign);
     $response->setGrossAnnualSalary($this->numberFormatter->parse($data["gross_annual_salary"]));
     $response->setVariableAnnualSalary($this->numberFormatter->parse($data["variable_annual_salary"]));
     $response->setAnnualSalary($this->numberFormatter->parse($data["annual_salary"]));
     $response->setSalarySatisfaction($this->numberFormatter->parse($data["salary_satisfaction"]));
     $response->setStatus($this->enums->getEnums('status')->getIdByLabel($data["status"]));
     $response->setJobTitle($this->enums->getEnums('job_title')->getIdByLabel($data["job_title"]));
     $response->setExperience($this->enums->getEnums('experience')->getIdByLabel($data["experience"]));
     $response->setInitialTraining($this->enums->getEnums('initial_training')->getIdByLabel($data["initial_training"]));
     $response->setCompanyType($this->enums->getEnums('company_type')->getIdByLabel($data["company_type"]));
     $response->setCompanySize($this->enums->getEnums('company_size')->getIdByLabel($data["company_size"]));
     $department = new Departments();
     if (in_array($data["company_department"], array_keys($department->getAll()))) {
         $response->setCompanyDepartment($data["company_department"]);
     }
     $response->setJobInterest($this->enums->getEnums('job_interest')->getIdByLabel($data["job_interest"]));
     $response->setPhpVersion($this->enums->getEnums('php_version')->getIdByLabel($data["php_version"]));
     $response->setPhpStrength($this->enums->getEnums('php_strength')->getIdByLabel($data["php_strength"]));
     $response->setHasRecentTraining("oui" === strtolower($data["has_formation"]));
     $response->setRecentTrainingHadSalaryImpact("oui" === strtolower($data["formation_impact"]));
     if ("oui" === strtolower($data['has_certification'])) {
         $this->addCertification($response, explode(', ', $data['certification_list']));
     }
     if (strlen(trim($data["speciality"])) !== 0) {
         $this->addSpeciality($response, explode(', ', $data['speciality']));
     }
     $response->setGender($this->enums->getEnums('gender')->getIdByLabel($data["gender"]));
     return $response;
 }
Exemplo n.º 2
0
 public function testSetCompanyDepartmentCorrectInput()
 {
     $department = new Collection();
     $department_array = $department->getAll();
     //Seules les valeurs de 1 à 9 sont réellement problématique, mais ça ne coute pas plus cher
     for ($i = 1; $i < 20; ++$i) {
         $response = new \Afup\BarometreBundle\Entity\Response();
         $response->setCompanyDepartment($i);
         $this->boolean(array_key_exists($response->getCompanyDepartment(), $department_array))->isTrue();
     }
 }
Exemplo n.º 3
0
 public function testGetAll()
 {
     $collection = new TestedClass();
     $this->array($all = $collection->getAll())->string($all['29'])->isEqualTo('Finistère');
 }