function _civicrm_api3_custom_search_create_spec(&$params) {
require_once 'api/v3/OptionValue.php';
_civicrm_api3_option_value_create_spec($params);
+ $params['option_group_id']['api.default'] = CRM_Core_DAO::getFieldValue(
+ 'CRM_Core_DAO_OptionGroup', 'custom_search', 'id', 'name'
+ );
$params['name']['api.aliases'] = array('class_name');
}
'description' => 'Longish description of the example search form',
'class_name' => 'CRM_Contact_Form_Search_Custom_Examplez',
));
- $this->assertEquals(0, $result['is_error'], 'In line ' . __LINE__);
+ $this->assertAPISuccess($result);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$entityId = $result['id'];
$this->assertTrue(is_numeric($entityId), 'In line ' . __LINE__);
'id' => $entityId,
'is_active' => 0,
));
- $this->assertEquals(0, $result['is_error'], 'In line ' . __LINE__);
+ $this->assertAPISuccess($result);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertDBQuery(1, 'SELECT count(*) FROM civicrm_option_value
WHERE name = "CRM_Contact_Form_Search_Custom_Examplez"
'id' => $entityId,
'is_active' => 1,
));
- $this->assertEquals(0, $result['is_error'], 'In line ' . __LINE__);
+ $this->assertAPISuccess($result);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertDBQuery(1, 'SELECT count(*) FROM civicrm_option_value
WHERE name = "CRM_Contact_Form_Search_Custom_Examplez"
'version' => $this->_apiversion,
'id' => $entityId,
));
- $this->assertEquals(0, $result['is_error'], 'In line ' . __LINE__);
+ $this->assertAPISuccess($result);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_option_value
WHERE name = "CRM_Contact_Form_Search_Custom_Examplez"