Example #1
0
 /**
  * CRM-18528 - Retrieve groups with filter
  */
 public function testGroupListWithFilter()
 {
     $this->setPermissionAndRequest(array('view all contacts', 'edit groups'));
     $_GET = $this->_params;
     $obj = new CRM_Group_Page_AJAX();
     //filter with title
     $_GET['title'] = "not-me-active";
     $groups = $obj->getGroupList();
     $this->assertEquals(1, $groups['recordsTotal']);
     $this->assertEquals('not-me-active', $groups['data'][0]['title']);
     unset($_GET['title']);
     // check on status
     $_GET['status'] = 2;
     $groups = $obj->getGroupList();
     foreach ($groups['data'] as $key => $val) {
         $this->assertEquals('crm-entity disabled', $val['DT_RowClass']);
     }
 }
Example #2
0
 /**
  * ACL Group hook.
  */
 public function testGroupListAclGroupHookEnabled()
 {
     $this->_params['status'] = 1;
     $this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
     list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
     $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default');
     $this->assertEquals(1, $total, 'Total needs to be set correctly');
     $this->assertEquals('pick-me-active', $groups[2]['group_name']);
 }