public function testGetSetTitle() { $expected = "Title"; $this->assertEmpty($this->instance->getTitle()); $this->assertTrue($this->instance->setTitle($expected) instanceof Person); $this->assertEquals($expected, $this->instance->getTitle()); }
/** * @param Person $person * @param ParamFetcher $paramFetcher * @return Questionnaire * @throws \Exception */ public function updatePerson(Person $person, ParamFetcher $paramFetcher) { $entityManager = $this->getEntityManager(); $person->setTitle($paramFetcher->get('title'))->setFirstName($paramFetcher->get('firstname'))->setLastName($paramFetcher->get('lastname'))->setEmailAddress($paramFetcher->get('emailaddress'))->setSignedUp($paramFetcher->get("opt_in"))->setAddress($person->getAddress()->setAddressLines($paramFetcher->get('address'))->setPostcode($paramFetcher->get('postcode'))); $person->setAge(null === $paramFetcher->get('age') ? $person->getAge() : $paramFetcher->get('age')); $person->setGender(null === $paramFetcher->get('gender') ? $person->getGender() : $paramFetcher->get('gender')); $entityManager->persist($person); $entityManager->flush(); return $this->getQuestionnaireFromPerson($person); }