예제 #1
0
 private function populateApplicantWithResponse(Applicant $applicant, $params)
 {
     $applicant->setId($params['id']);
     $applicant->setHref($params['href']);
     $applicant->setCreatedAt($params['created_at']);
     $applicant->setFirstName($params['first_name']);
     $applicant->setLastName($params['last_name']);
     $applicant->setDob($params['dob']);
     $applicant->setEmail($params['email']);
     $applicant->setTitle($params['title']);
     $applicant->setMiddleName($params['middle_name']);
     $applicant->setGender($params['gender']);
     $applicant->setTelephone($params['telephone']);
     $applicant->setMobile($params['mobile']);
     $applicant->setCountry($params['country']);
     if (empty($params['addresses']) === false) {
         foreach ($params['addresses'] as $addressInfo) {
             $address = new Address();
             $address->setFlatNumber($addressInfo['flat_number']);
             $address->setBuildingNumber($addressInfo['building_number']);
             $address->setStreet($addressInfo['street']);
             $address->setSubStreet($addressInfo['sub_street']);
             $address->setTown($addressInfo['town']);
             $address->setState($addressInfo['state']);
             $address->setPostcode($addressInfo['postcode']);
             $address->setCountry($addressInfo['country']);
             $address->setStartDate($addressInfo['start_date']);
             $address->setEndDate($addressInfo['end_date']);
             $applicant->addAddress($address);
         }
     }
 }
예제 #2
0
 public function testToArray()
 {
     $applicant = new Applicant();
     $applicant->setTitle('Mr');
     $applicant->setFirstName('Tester');
     $applicant->setMiddleName('Miles');
     $applicant->setLastName('Testerston');
     $applicant->setEmail('*****@*****.**');
     $applicant->setGender('male');
     $applicant->setDob('1987/11/11');
     $applicant->setTelephone('1234567890');
     $applicant->setCountry('usa');
     $applicant->setIdNumbers(array(array('type' => 'ssn', 'value' => '123-45-6789')));
     $address = new Address();
     $address->setBuildingNumber('20');
     $address->setStreet('Lavaca');
     $address->setTown('San Diego');
     $address->setState('CA');
     $address->setPostcode('78702');
     $address->setStartDate('1990/12/25');
     $applicant->addAddress($address);
     $expected = array('id' => null, 'created_at' => null, 'href' => null, 'title' => 'Mr', 'first_name' => 'Tester', 'middle_name' => 'Miles', 'last_name' => 'Testerston', 'email' => '*****@*****.**', 'gender' => 'male', 'dob' => '1987/11/11', 'telephone' => '1234567890', 'mobile' => null, 'country' => 'usa', 'id_numbers' => array(array('type' => 'ssn', 'value' => '123-45-6789')), 'addresses' => array(array('flat_number' => null, 'building_name' => null, 'building_number' => '20', 'street' => 'Lavaca', 'sub_street' => null, 'state' => 'CA', 'town' => 'San Diego', 'postcode' => '78702', 'country' => null, 'start_date' => '1990/12/25', 'end_date' => null)));
     $actual = $applicant->toArray();
     $this->assertEquals($expected, $actual);
 }