/**
  * test deleting groupmembers
  *
  */
 public function testRemoveGroupMember()
 {
     $group = $this->_groupLDAP->getGroupByName('tine20phpunit');
     $this->objects['initialAccount']->accountPrimaryGroup = $group->getId();
     try {
         $user = $this->_userLDAP->addUser($this->objects['initialAccount']);
     } catch (Exception $e) {
         $user = $this->_userLDAP->getUserByLoginName($this->objects['initialAccount']->accountLoginName);
     }
     $this->_groupLDAP->addGroupMember($group, $user);
     $this->_groupLDAP->removeGroupMember($group, $user);
     $groupMembers = $this->_groupLDAP->getGroupMembers($group);
     $this->assertEquals(0, count($groupMembers));
     $this->_userLDAP->deleteUser($user);
 }
 /**
  * @see 0009852: improve cache cleaning after LDAP sync
  */
 public function testSyncGroups()
 {
     $defaultUserGroup = Tinebase_Group::getInstance()->getDefaultGroup();
     $group = $this->testAddGroup();
     $user = $this->_addUserToGroup($group);
     // add user to group (only in LDAP)
     $this->_groupLDAP->addGroupMemberInSyncBackend($defaultUserGroup->getId(), $user);
     // trigger caching
     $memberships = $this->_groupLDAP->getGroupMembers($defaultUserGroup);
     $this->assertFalse(in_array($user->getId(), $memberships));
     // sync users
     Tinebase_User::syncUsers(array('syncContactData' => TRUE));
     // check group memberships
     $memberships = $this->_groupLDAP->getGroupMembers($defaultUserGroup);
     $this->assertTrue(in_array($user->getId(), $memberships), 'group memberships not updated: ' . print_r($memberships, true));
 }