* @access public
*/
function civicrm_api3_job_delete($params) {
- if ($params['id'] != NULL && !CRM_Utils_Rule::integer($params['id'])) {
- return civicrm_api3_create_error('Invalid value for job ID');
- }
-
- $result = CRM_Core_BAO_Job::del($params['id']);
- if (!$result) {
- return civicrm_api3_create_error('Could not delete job');
- }
- return civicrm_api3_create_success($result, $params, 'job', 'delete');
+ _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
* @return array
*/
function _civicrm_api3_system_log_create_spec(&$params) {
- return _civicrm_api3_system_log_spec($params);
+ require_once('api/v3/System.php');
+ _civicrm_api3_system_log_spec($params);
}
/**
$this->assertEquals($result['values'][$result['id']]['note'], 'Hello!!! m testing Note', 'in line ' . __LINE__);
$this->assertEquals(date('Y-m-d', strtotime($this->_params['modified_date'])), date('Y-m-d', strtotime($result['values'][$result['id']]['modified_date'])), 'in line ' . __LINE__);
- $this->assertArrayHasKey('id', $result, 'in line ' . __LINE__);
- $this->assertAPISuccess($result, 'in line ' . __LINE__);
+ $this->assertArrayHasKey('id', $result);
$note = array(
'id' => $result['id'], );
$this->noteDelete($note);
'MailSettings',
'Setting',
'MailingContact',
+ 'SystemLog' //skip this because it doesn't make sense to update logs
);
if ($sequential === TRUE) {
return $entitiesWithout;
*
* @access protected
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ $this->quickCleanup(array('civicrm_system_log'));
+ }
///////////////// civicrm_domain_get methods
$this->assertEquals($result['message'], 'We wish you a merry Christmas');
$this->assertEquals($result['level'], 'info');
}
+
+ /**
+ * Test system log function
+ */
+ function testSystemLogNoLevel() {
+ $this->callAPISuccess('system', 'log', array( 'message' => 'We wish you a merry Christmas'));
+ $result = $this->callAPISuccess('SystemLog', 'getsingle', array('sequential' => 1, 'message' => array('LIKE' => '%Chris%')));
+ $this->assertEquals($result['message'], 'We wish you a merry Christmas');
+ $this->assertEquals($result['level'], 'info');
+ $this->callAPISuccess('system_log', 'create', array('message' => 'msg'));
+ }
}
'description' => 'Outside undie-wearers',
);
$result = $this->callAPIAndDocument('tag', 'create', $params, __FUNCTION__, __FILE__);
- $this->assertNotNull($result['id'], 'In line ' . __LINE__);
+ $this->assertNotNull($result['id']);
$params['used_for'] = 'civicrm_contact';
$this->getAndCheck($params, $result['id'], 'tag');
}