/**
  * test create contact
  * 
  * @return Addressbook_Frontend_WebDAV_Contact
  */
 public function testCreateContact()
 {
     if (!isset($_SERVER['HTTP_USER_AGENT'])) {
         $_SERVER['HTTP_USER_AGENT'] = 'FooBar User Agent';
     }
     $vcardStream = fopen(dirname(__FILE__) . '/../../Import/files/sogo_connector.vcf', 'r');
     $id = Tinebase_Record_Abstract::generateUID();
     $contact = Addressbook_Frontend_WebDAV_Contact::create($this->objects['initialContainer'], "{$id}.vcf", $vcardStream);
     $this->objects['contactsToDelete'][] = $contact;
     $record = $contact->getRecord();
     $this->assertEquals('*****@*****.**', $record->email);
     $this->assertEquals('Kneschke', $record->n_family);
     $this->assertEquals('+49 BUSINESS', $record->tel_work);
     return $contact;
 }
 /**
  * Creates a new file
  *
  * The contents of the new file must be a valid VCARD
  *
  * @param  string    $name
  * @param  resource  $vobjectData
  * @return string    the etag of the record
  */
 public function createFile($name, $vobjectData = null)
 {
     $container = Tinebase_Container::getInstance()->getDefaultContainer('Addressbook_Model_Contact', $this->_user);
     $object = Addressbook_Frontend_WebDAV_Contact::create($container, $name, $vobjectData);
     return $object->getETag();
 }
 /**
  * test get vcard
  */
 public function testGetContact()
 {
     $contact = $this->testCreateContact();
     $backend = new Addressbook_Frontend_WebDAV_Contact($this->objects['initialContainer'], $contact->getName());
     $vcard = \Sabre\VObject\Reader::read($backend->get());
     $this->assertEquals('+49 BUSINESS', $vcard->TEL->getValue());
     $this->assertContains('CATEGORY 1', $vcard->CATEGORIES->getParts());
     $this->assertContains('CATEGORY 2', $vcard->CATEGORIES->getParts());
 }