/** * execute Tinebase_User::syncUser * * TODO test bday */ public function testSyncUsersContactData() { Tinebase_Config::getInstance()->set(Tinebase_Config::LDAP_OVERWRITE_CONTACT_FIELDS, array('tel_work', 'jpegphoto')); // add user in LDAP $user = $this->_backend->addUserToSyncBackend(self::getTestRecord()); $this->_usernamesToDelete[] = $user->accountLoginName; $syncedUser = Tinebase_User::syncUser($user); // check if user is synced $this->assertEquals(Tinebase_Model_User::VISIBILITY_DISPLAYED, $syncedUser->visibility, print_r($syncedUser->toArray(), true)); // add+remove phone data in ldap and check if it is removed in adb, too $syncOptions = array('syncContactData' => true, 'syncContactPhoto' => true); $ldap = $this->_backend->getLdap(); $dn = $this->_backend->generateDn($syncedUser); $number = '040-428457634'; $jpegImage = file_get_contents(dirname(dirname(dirname(dirname(__DIR__)))) . '/tine20/Admin/Setup/DemoData/persona_sclever.jpg'); $ldap->updateProperty($dn, array('telephonenumber' => $number, 'jpegphoto' => $jpegImage)); $syncedUser = Tinebase_User::syncUser($user, $syncOptions); $contact = Addressbook_Controller_Contact::getInstance()->getContactByUserId($syncedUser->getId()); $this->assertEquals($number, $contact->tel_work); $this->assertEquals(1, $contact->jpegphoto); //$this->assertEquals('2000-09-09 00:00:00', $contact->bday->toString()); // remove number + photo and sync again $ldap->updateProperty($dn, array('telephonenumber' => '', 'jpegphoto' => '')); $syncedUser = Tinebase_User::syncUser($user, $syncOptions); $contact = Addressbook_Controller_Contact::getInstance()->getContactByUserId($syncedUser->getId()); $this->assertEquals('', $contact->tel_work); $this->assertEquals(0, $contact->jpegphoto); }