/**
  * 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);
 }