'version' => $this->_apiversion,
);
$customGroup = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($customGroup['is_error'], 1, 'In line ' . __LINE__);
+ $this->assertAPIFailure($customGroup, 'In line ' . __LINE__);
$this->assertEquals($customGroup['error_message'],
'Mandatory key(s) missing from params array: title, extends', 'In line ' . __LINE__
);
$customGroup = civicrm_api('custom_group', 'create', $params);
$this->assertEquals($customGroup['error_message'], 'Mandatory key(s) missing from params array: extends', 'In line ' . __LINE__);
- $this->assertEquals($customGroup['is_error'], 1, 'In line ' . __LINE__);
+ $this->assertAPIFailure($customGroup, 'In line ' . __LINE__);
}
/**
);
$customGroup = civicrm_api('custom_group', 'create', $params);
+ $this->assertAPIFailure($customGroup, 'In line ' . __LINE__);
$this->assertEquals($customGroup['error_message'], 'Mandatory key(s) missing from params array: extends', 'In line ' . __LINE__);
- $this->assertEquals($customGroup['is_error'], 1, 'In line ' . __LINE__);
}
/**
);
$result = civicrm_api('custom_group', 'getfields', $params);
+ $this->assertAPISuccess($result);
+ $this->assertArrayKeyExists('options', $result['values'], ' check that options are rendered for fieldtype enum');
$this->assertEquals('Tab', $result['values']['style']['options'][0]);
$this->assertEquals('Inline', $result['values']['style']['options'][1]);
);
$result = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($result['is_error'], 1, 'In line ' . __LINE__);
+ $this->assertAPIFailure($result, 'In line ' . __LINE__);
$this->assertEquals($result['error_message'], 'implode(): Invalid arguments passed', 'In line ' . __LINE__);
}
);
$customGroup = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($customGroup['is_error'], 0, 'In line ' . __LINE__);
+ $this->assertAPISuccess($customGroup, 'In line ' . __LINE__);
$this->assertNotNull($customGroup['id'], 'In line ' . __LINE__);
$this->assertEquals($customGroup['values'][$customGroup['id']]['style'], 'Inline', 'In line ' . __LINE__);
}
function testCustomGroupCreateNotArray() {
$params = NULL;
$customGroup = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($customGroup['is_error'], 1, 'In line ' . __LINE__);
+ $this->assertAPIFailure($customGroup, 'In line ' . __LINE__);
$this->assertEquals($customGroup['error_message'], 'Input variable `params` is not an array', 'In line ' . __LINE__);
}
$customGroup = civicrm_api('custom_group', 'create', $params);
$this->assertEquals($customGroup['error_message'], 'Mandatory key(s) missing from params array: title', 'In line ' . __LINE__);
- $this->assertEquals($customGroup['is_error'], 1, 'In line ' . __LINE__);
+ $this->assertAPIFailure($customGroup, 'In line ' . __LINE__);
}
/**
);
$customGroup = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($customGroup['is_error'], 0, 'In line ' . __LINE__);
+ $this->assertAPISuccess($customGroup, 'In line ' . __LINE__);
$this->assertNotNull($customGroup['id'], 'In line ' . __LINE__);
$this->assertEquals($customGroup['values'][$customGroup['id']]['extends'], 'Household', 'In line ' . __LINE__);
$this->assertEquals($customGroup['values'][$customGroup['id']]['style'], 'Tab', 'In line ' . __LINE__);
);
$customGroup = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($customGroup['is_error'], 0, 'In line ' . __LINE__);
+ $this->assertAPISuccess($customGroup, 'In line ' . __LINE__);
$this->assertNotNull($customGroup['id'], 'In line ' . __LINE__);
$this->assertEquals($customGroup['values'][$customGroup['id']]['extends'], 'Contribution', 'In line ' . __LINE__);
}
);
$customGroup = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($customGroup['is_error'], 0, 'In line ' . __LINE__);
+ $this->assertAPISuccess($customGroup, 'In line ' . __LINE__);
$this->assertNotNull($customGroup['id'], 'In line ' . __LINE__);
$this->assertEquals($customGroup['values'][$customGroup['id']]['extends'], 'Group', 'In line ' . __LINE__);
}
);
$customGroup = civicrm_api('custom_group', 'create', $params);
- $this->assertEquals($customGroup['is_error'], 0, 'In line ' . __LINE__);
+ $this->assertAPISuccess($customGroup, 'In line ' . __LINE__);
$this->assertNotNull($customGroup['id'], 'In line ' . __LINE__);
$this->assertEquals($customGroup['values'][$customGroup['id']]['extends'], 'Activity', 'In line ' . __LINE__);
}
'version' => $this->_apiversion,
);
$customGroup = civicrm_api('custom_group', 'delete', $params);
- $this->assertEquals($customGroup['is_error'], 1, 'In line ' . __LINE__);
+ $this->assertAPIFailure($customGroup, 'In line ' . __LINE__);
$this->assertEquals($customGroup['error_message'], 'Mandatory key(s) missing from params array: id', 'In line ' . __LINE__);
}
);
$result = civicrm_api('custom_group', 'delete', $params);
$this->documentMe($params, $result, __FUNCTION__, __FILE__);
- $this->assertEquals($result['is_error'], 0, 'In line ' . __LINE__);
+ $this->assertAPISuccess($result, 'In line ' . __LINE__);
}
/*
* main success get function
$params = array('version' => 3);
$result = civicrm_api($this->_entity, 'get', $params);
$this->documentMe($params, $result, __FUNCTION__, __FILE__);
- $this->assertEquals($result['is_error'], 0, 'in line' . __LINE__);
+ $this->assertAPISuccess($result, 'In line ' . __LINE__);
$values = $result['values'][$result['id']];
foreach ($this->_params as $key => $value) {
if ($key == 'version' || $key == 'weight') {