/** 
  * @depends testPutPerson
  * @param Batchblue_Service_BatchBook_Person $person
  * @return void
  */
 public function testAddTag(Batchblue_Service_BatchBook_Person $person)
 {
     $tagA = new Batchblue_Service_BatchBook_Tag();
     $tagA->setName('my_test_tag_a' . md5(uniqid(rand(), true)));
     $tagB = new Batchblue_Service_BatchBook_Tag();
     $tagB->setName('my_test_tag_b' . md5(uniqid(rand(), true)));
     $this->_personService->addTag($person, $tagA);
     $this->_personService->addTag($person, $tagB);
     $getPerson = $this->_personService->getPerson($person->getId());
     $tags = $getPerson->getTags();
     $this->assertGreaterThanOrEqual(2, count($tags));
     $foundTagA = false;
     $foundTagB = false;
     foreach ($tags as $currentTag) {
         if ($currentTag->getName() == $tagA->getName()) {
             $foundTagA = true;
         }
         if ($currentTag->getName() == $tagB->getName()) {
             $foundTagB = true;
         }
     }
     $this->assertTrue($foundTagA, "Looking for tagA: " . $tagA->getName());
     $this->assertTrue($foundTagB, "Looking for tagB: " . $tagB->getName());
 }
 /**
  * Add Tag
  *
  * @param Batchblue_Service_BatchBook_Person $person
  * @param string $tag
  */
 public function addTag(Batchblue_Service_BatchBook_Person $person, Batchblue_Service_BatchBook_Tag $tag)
 {
     $httpClient = new Zend_Http_Client('https://' . $this->_accountName . '.batchbook.com/service/people/' . $person->getId() . '/add_tag.xml');
     $paramsPut = array('tag' => $tag->getName());
     $httpClient->setAuth($this->_token, 'x');
     $httpClient->setHeaders(Zend_Http_Client::CONTENT_TYPE, Zend_Http_Client::ENC_URLENCODED);
     $httpClient->setRawData(http_build_query($paramsPut, '', '&'), Zend_Http_Client::ENC_URLENCODED);
     $response = $httpClient->request(Zend_Http_Client::PUT);
     if (200 != $response->getStatus()) {
         //TODO: throw more specific exception
         throw new Exception('Tag not added to person with id=' . $person->getId());
     }
 }