本文整理汇总了PHP中Tinebase_Group::syncListsOfUserContact方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Group::syncListsOfUserContact方法的具体用法?PHP Tinebase_Group::syncListsOfUserContact怎么用?PHP Tinebase_Group::syncListsOfUserContact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Group
的用法示例。
在下文中一共展示了Tinebase_Group::syncListsOfUserContact方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSyncLists
/**
* testSyncLists
*
* @see 0005768: create addressbook lists when migrating users
*
* @todo make this work for LDAP accounts backend: currently the user is not present in sync backend but in sql
*/
public function testSyncLists()
{
if (Tinebase_Group::getInstance() instanceof Tinebase_Group_Ldap) {
$this->markTestSkipped('@todo make this work for LDAP accounts backend');
}
$testGroup = $this->testAddGroup();
// don't use any existing persona here => will break other tests
$testUser = new Tinebase_Model_FullUser(array('accountLoginName' => Tinebase_Record_Abstract::generateUID(), 'accountPrimaryGroup' => $testGroup->getId(), 'accountDisplayName' => Tinebase_Record_Abstract::generateUID(), 'accountLastName' => Tinebase_Record_Abstract::generateUID(), 'accountFullName' => Tinebase_Record_Abstract::generateUID(), 'visibility' => Tinebase_Model_User::VISIBILITY_DISPLAYED));
$contact = Admin_Controller_User::getInstance()->createOrUpdateContact($testUser);
$testUser->contact_id = $contact->getId();
$testUser = Tinebase_User::getInstance()->addUserInSqlBackend($testUser);
Tinebase_User::createContactForSyncedUser($testUser);
Tinebase_User::getInstance()->updateUserInSqlBackend($testUser);
$this->testSetGroupMembers($testGroup, array($testUser->accountId));
Tinebase_Group::syncListsOfUserContact(array($testGroup->getId()), $testUser->contact_id);
$group = Tinebase_Group::getInstance()->getGroupById($testGroup);
$this->assertTrue(!empty($group->list_id), 'list id empty: ' . print_r($group->toArray(), TRUE));
$list = Addressbook_Controller_List::getInstance()->get($group->list_id);
$this->assertEquals($group->getId(), $list->group_id);
$this->assertEquals($group->name, $list->name);
$this->assertTrue(!empty($list->members), 'list members empty: ' . print_r($list->toArray(), TRUE) . ' should contain: ' . print_r($testUser->toArray(), TRUE));
$this->assertContains($testUser->contact_id, $list->members);
$appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
$this->assertTrue(!empty($appConfigDefaults), 'app config defaults empty');
$internal = $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK];
$this->assertEquals($internal, $list->container_id, 'did not get correct internal container');
// sync again -> should not change anything
Tinebase_Group::syncListsOfUserContact(array($group->getId()), $testUser->contact_id);
$listAgain = Addressbook_Controller_List::getInstance()->get($group->list_id);
$this->assertEquals($list->toArray(), $listAgain->toArray());
// change list id -> should get list by (group) name
$group->list_id = NULL;
$group = Tinebase_Group::getInstance()->updateGroup($group);
Tinebase_Group::syncListsOfUserContact(array($group->getId()), $testUser->contact_id);
$this->assertEquals($list->getId(), Tinebase_Group::getInstance()->getGroupById($group)->list_id);
}
示例2: testSyncLists
/**
* testSyncLists
*
* @see http://forge.tine20.org/mantisbt/view.php?id=5768
*/
public function testSyncLists()
{
$group = $this->objects['initialGroup'];
Tinebase_User::syncContact($this->objects['account1']);
Tinebase_User::getInstance()->updateUserInSqlBackend($this->objects['account1']);
$this->testSetGroupMembers();
Tinebase_Group::syncListsOfUserContact(array($group->getId()), $this->objects['account1']->contact_id);
$group = Tinebase_Group::getInstance()->getGroupById($this->objects['initialGroup']);
$this->assertTrue(!empty($group->list_id), 'list id empty: ' . print_r($group->toArray(), TRUE));
$list = Addressbook_Controller_List::getInstance()->get($group->list_id);
$this->assertEquals($group->getId(), $list->group_id);
$this->assertEquals($group->name, $list->name);
$this->assertTrue(!empty($list->members), 'list members empty: ' . print_r($list->toArray(), TRUE));
$this->assertEquals($this->objects['account1']->contact_id, $list->members[0]);
$appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
$internal = $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK];
$this->assertEquals($internal, $list->container_id);
// sync again -> should not change anything
Tinebase_Group::syncListsOfUserContact(array($group->getId()), $this->objects['account1']->contact_id);
$listAgain = Addressbook_Controller_List::getInstance()->get($group->list_id);
$this->assertEquals($list->toArray(), $listAgain->toArray());
}