/** * test create contact with photo * * @return Addressbook_Frontend_WebDAV_Contact */ public function testCreateContactWithPhoto() { $vcardStream = fopen(dirname(__FILE__) . '/../../Import/files/jan.vcf', 'r'); $id = Tinebase_Record_Abstract::generateUID(); $contact = Addressbook_Frontend_WebDAV_Contact::create($this->objects['initialContainer'], "{$id}.vcf", $vcardStream); $record = $contact->getRecord(); $imgBlob = $record->getSmallContactImage(); $this->assertTrue(strlen($imgBlob) > 0); $this->assertTrue(strlen($imgBlob) < Addressbook_Model_Contact::SMALL_PHOTO_SIZE); }
/** * 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(); }