$columns = CRM_Utils_Array::value('columns', $params, array());
foreach ($columns as $key => $value) {
$sortMapper[$key] = $value['data'];
- };
+ }
$offset = isset($_GET['start']) ? CRM_Utils_Type::escape($_GET['start'], 'Integer') : 0;
$rowCount = isset($_GET['length']) ? CRM_Utils_Type::escape($_GET['length'], 'Integer') : 25;
}
}
- //add setting so this can be tested by unit test
- //@todo - ideally the portion of this that retrieves the groups should be extracted into a function separate
- // from the one which deals with web inputs & outputs so we have a properly testable & re-usable function
- if (!empty($params['is_unit_test'])) {
- return array($groups['data'], $params['total']);
- }
CRM_Utils_JSON::output($groups);
}
}
*/
public function testGroupListViewAllContacts() {
$this->setPermissionAndRequest(array('view all contacts', 'edit groups'));
- list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
- $this->assertEquals(2, $total);
- $this->assertEquals('<span class="crm-editable crmf-title">pick-me-active</span>', $groups[2]['group_name']);
- $this->assertEquals('<span class="crm-editable crmf-title">not-me-active</span>', $groups[4]['group_name']);
+ $params = $this->_params;
+ $groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
+ $this->assertEquals(2, $groups['recordsTotal']);
+ $this->assertEquals('<span class="crm-editable crmf-title">pick-me-active</span>', $groups['data'][2]['group_name']);
+ $this->assertEquals('<span class="crm-editable crmf-title">not-me-active</span>', $groups['data'][4]['group_name']);
}
/**