/**
  * Create Person From XML
  *
  * @param SimpleXMLElement $xmlElement
  * @return Batchblue_Service_BatchBook_Person
  */
 private function _populatePersonFromXmlElement(SimpleXMLElement $xmlElement, Batchblue_Service_BatchBook_Person $person = null)
 {
     if (null === $person) {
         $person = new Batchblue_Service_BatchBook_Person();
     }
     $person->setId($xmlElement->id)->setFirstName($xmlElement->first_name)->setLastName($xmlElement->last_name)->setTitle($xmlElement->title)->setCompany($xmlElement->company)->setNotes($xmlElement->notes);
     $locations = array();
     $tags = array();
     foreach ($xmlElement->tags->tag as $xmlTag) {
         if ($xmlTag->supertag) {
             $tag = new Batchblue_Service_BatchBook_SuperTag();
             $tag->setName($xmlTag->name);
             $tag->setFields($xmlTag->fields);
         } else {
             $tag = new Batchblue_Service_BatchBook_Tag();
             $tag->setName($xmlTag->name);
         }
         array_push($tags, $tag);
     }
     foreach ($xmlElement->locations->location as $xmlLocation) {
         $location = new Batchblue_Service_BatchBook_Location();
         $location->setId($xmlLocation->id)->setLabel($xmlLocation->label)->setEmail($xmlLocation->email)->setWebsite($xmlLocation->website)->setPhone($xmlLocation->phone)->setCell($xmlLocation->cell)->setFax($xmlLocation->fax)->setStreet1($xmlLocation->street_1)->setStreet2($xmlLocation->street_2)->setCity($xmlLocation->city)->setState($xmlLocation->state)->setPostalCode($xmlLocation->postal_code)->setCountry($xmlLocation->country);
         array_push($locations, $location);
     }
     $person->setLocations($locations);
     $person->setTags($tags);
     return $person;
 }
 /**
  * @depends testGetPerson
  * @param Batchblue_Service_BatchBook_Person $person
  * @return Batchblue_Service_BatchBook_Person
  */
 public function testPutPerson(Batchblue_Service_BatchBook_Person $person)
 {
     $location = new Batchblue_Service_BatchBook_Location();
     $location->setEmail(md5(uniqid(rand(), true)) . '*****@*****.**')->setPhone('123-123-9999');
     $locations = array($location);
     $person->setFirstName('TestFirstName')->setLastName('TestLastName')->setTitle('Developer')->setCompany('Test Company')->setNotes('Test notes go here')->setLocations($locations);
     $this->_personService->putPerson($person);
     $getPerson = $this->_personService->getPerson($person->getId());
     //the id is in there when it comes back, so to make the test pass, put it in!
     $getLocations = $getPerson->getLocations();
     $location->setId($getLocations[0]->getId());
     $this->assertEquals($person, $getPerson);
     return $person;
 }