private function getUser() { $date = new \DateTime(); $date->setDate(1980, 1, 1); $user = new Person(); $user->setSalutation(PERSON::SALUTATIONMALE)->setName($this->faker->name)->setSurname($this->faker->name)->setDateOfBirth($date)->setEmail($this->faker->email)->setPhoneNumber('03452696645')->setFaxNumber('03452696645'); return $user; }
/** * @param Processor $processor * @param $value * @return AmountClass */ public function unserializeProperty(Processor $processor, $value) { $person = new PersonClass(); $person->setUnserializedData($value); $dob = new \DateTime(); list($year, $month, $day) = explode('-', $value['dateOfBirth']); $dob->setDate($year, $month, $day); $person->setDateOfBirth($dob); return $person; }
private function getPerson() { $person = new Person(); $person->setSalutation(Person::SALUTATIONMALE)->setName($this->faker->name)->setSurname($this->faker->name)->setDateOfBirth(new \DateTime())->setEmail($this->faker->email)->setPhoneNumber('555666')->setFaxNumber('555454'); return $person; }
/** * As the fax number must be numeric the library will strip out any non numeric characters */ public function testSetFaxNumber() { $person = new Person(); $person->setFaxNumber($this->faker->phoneNumber); $this->assertNotEmpty($person->getFaxNumber(), "No phone number was set"); $this->assertRegExp('/^\\d+$/', $person->getFaxNumber(), "Phone number contains non numeric characters"); /** * Test strip out mechanism works */ $person->setFaxNumber("555447B"); $this->assertNotEmpty($person->getFaxNumber(), "No phone number was set"); $this->assertRegExp('/^\\d+$/', $person->getFaxNumber(), "Phone number contains non numeric characters"); }