示例#1
0
 public function testGetSetPerson()
 {
     $person = new Person();
     $person->setAka('Delboy');
     $this->user->setPerson($person);
     $this->assertInstanceOf('Del\\Person\\Entity\\Person', $this->user->getPerson());
     $this->assertEquals('Delboy', $this->user->getPerson()->getAka());
 }
示例#2
0
 /**
  * @param PersonEntity $person
  * @return bool|int
  */
 public function findKey(PersonEntity $person)
 {
     $it = $this->getIterator();
     $it->rewind();
     while ($it->valid()) {
         if ($it->current()->getId() == $person->getId()) {
             return $it->key();
         }
         $it->next();
     }
     return false;
 }
 public function testUpdate()
 {
     $collection = new People();
     $person = new Person();
     $person->setId(1);
     $collection->append($person);
     $person = new Person();
     $person->setId(2);
     $collection->append($person);
     $person = new Person();
     $person->setId(3);
     $collection->append($person);
     $collection->first();
     $collection->next();
     $person = $collection->current();
     //id 2
     $person->setFirstname('Theodoric');
     $collection->update($person);
     $this->assertEquals('Theodoric', $collection[1]->getFirstname());
     $person = new Person();
     $person->setId(4);
     $this->setExpectedException('LogicException');
     $collection->update($person);
 }
示例#4
0
 /**
  * @return array
  */
 private function getUserArray($functionName = 'getUserArray')
 {
     $person = new Person();
     $person->setFirstname($functionName);
     return ['person' => $person, 'email' => '*****@*****.**', 'lastLogin' => '1970-01-01', 'registrationDate' => '1970-01-01', 'state' => State::STATE_UNACTIVATED, 'password' => $functionName];
 }
示例#5
0
 public function testGetSetImage()
 {
     $this->person->setImage('photo.jpg');
     $this->assertEquals('photo.jpg', $this->person->getImage());
 }
示例#6
0
 /**
  * @param Person $person
  * @return array
  */
 public function toArray(Person $person)
 {
     $data = ['id' => $person->getId(), 'firstname' => $person->getFirstname(), 'middlename' => $person->getMiddlename(), 'lastname' => $person->getLastname(), 'aka' => $person->getAka(), 'dob' => $person->getDob(), 'birthplace' => $person->getBirthplace(), 'country' => $person->getCountry()];
     return $data;
 }