/** * @param string $firstName * @param callable $callback * * @return Applicant */ private function addStandardApplicant($firstName, callable $callback = null) { $applicant = new Applicant(); $eligibility = new Eligibility(); $nationality = new Nationality(); $registration = new Registration(); $nationality->setName('British'); $eligibility->setPresentNationality($nationality); $eligibility->setSubjectToImmigrationControls(true); $eligibility->setSubjectToImmigrationControlsDetails('I require a Visa'); $eligibility->setResidencyOrEmploymentRestrictions(false); $eligibility->setPermissionToCheckBackground(true); $registration->setHeardAboutUs('I have heard'); $registration->setDisabledDetails('I am disabled'); $registration->setDisabledAdjustmentDetails('I would like an adjustment'); $applicant->setEnabled(true); $applicant->setEmail(strtolower($firstName) . '@test.com'); $applicant->setPlainPassword('P@ssword1'); $applicant->setUsername(md5($firstName)); $applicant->setFirstname($firstName); $applicant->setLastname('Persona'); $applicant->setAddress((new Address())->setLine1('123 Some Street')->setTown('Some Town')->setCounty('Some County')->setPostcode('AB12 3CD')->setCountry('GB')); $applicant->setPhoneNumber((new PhoneNumber())->setNumber('123456789')); $applicant->setEligibility($eligibility); $applicant->setRegistration($registration); if ($callback != null) { $callback($applicant); } $this->manager->persist($applicant); return $applicant; }
function it_should_set_then_get_present_nationality(Nationality $nationality) { $nationality->setName('British'); $this->getPresentNationality()->shouldReturnAnInstanceOf('TransformCore\\Bundle\\CsrFastStreamBundle\\Entity\\Nationality'); $this->setPresentNationality($nationality)->shouldHaveType('TransformCore\\Bundle\\CsrFastStreamBundle\\Entity\\Eligibility'); $this->getPresentNationality()->shouldReturn($nationality); }