/**
  * testBuildGroupMemberPathForContact
  */
 public function testBuildGroupMemberPathForContact()
 {
     $contact = Addressbook_Controller_Contact::getInstance()->create(new Addressbook_Model_Contact(array('n_family' => 'tester', 'email' => '*****@*****.**')));
     $adbJson = new Addressbook_Frontend_Json();
     $listRole = $adbJson->saveListRole(array('name' => 'my role', 'description' => 'my test description'));
     $listRole2 = $adbJson->saveListRole(array('name' => 'my second role', 'description' => 'my test description'));
     $memberroles = array(array('contact_id' => $contact->getId(), 'list_role_id' => $listRole['id']), array('contact_id' => $contact->getId(), 'list_role_id' => $listRole2['id']));
     $adbJson->saveList(array('name' => 'my test group', 'description' => '', 'members' => array($contact->getId()), 'memberroles' => $memberroles, 'type' => Addressbook_Model_List::LISTTYPE_LIST, 'relations' => array($this->_getParentRelationArray($this->_getFatherWithGrandfather()))));
     $recordPaths = $this->_uit->generatePathForRecord($contact);
     $this->assertTrue($recordPaths instanceof Tinebase_Record_RecordSet);
     $this->assertEquals(2, count($recordPaths), 'should find 2 path for record. paths:' . print_r($recordPaths->toArray(), true));
     $expectedPaths = array('/grandparent/father/my test group/my role/tester', '/grandparent/father/my test group/my second role/tester');
     foreach ($expectedPaths as $expectedPath) {
         $this->assertTrue(in_array($expectedPath, $recordPaths->path), 'could not find path ' . $expectedPath . ' in ' . print_r($recordPaths->toArray(), true));
     }
     return $contact;
 }
 /**
  * @see 0011584: allow to set group member roles
  */
 public function testCeateListWithMemberAndRole($listRoleName = 'my test role')
 {
     $contact = $this->_addContact();
     $listRole = $this->_uit->saveListRole(array('name' => $listRoleName, 'description' => 'my test description'));
     $memberroles = array(array('contact_id' => $contact['id'], 'list_role_id' => $listRole['id']));
     $list = $this->_uit->saveList(array('name' => 'my test list', 'description' => '', 'members' => array($contact['id']), 'memberroles' => $memberroles, 'type' => Addressbook_Model_List::LISTTYPE_LIST));
     $this->assertEquals(array($contact['id']), $list['members'], 'members are not saved/returned in list: ' . print_r($list, true));
     $this->assertTrue(isset($list['memberroles']), 'memberroles missing from list');
     $this->assertEquals(1, count($list['memberroles']), 'member roles are not saved/returned in list: ' . print_r($list, true));
     $this->assertTrue(isset($list['memberroles'][0]['list_role_id']['id']), 'list roles should be resolved');
     $this->assertEquals($listRole['id'], $list['memberroles'][0]['list_role_id']['id'], 'member roles are not saved/returned in list: ' . print_r($list, true));
     return $list;
 }