ignore system_log in update single test as updating logs doesn't make sense
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 5 May 2014 03:14:39 +0000 (20:14 -0700)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 5 May 2014 03:14:39 +0000 (20:14 -0700)
api/v3/Job.php
api/v3/SystemLog.php
tests/phpunit/api/v3/NoteTest.php
tests/phpunit/api/v3/SyntaxConformanceTest.php
tests/phpunit/api/v3/SystemTest.php
tests/phpunit/api/v3/TagTest.php

index cb8bbfac7300b94cdee18e970335039719a6f2f3..1b8452128b1d2f03bd020b3ed9c9f9a32ded9f19 100644 (file)
@@ -98,15 +98,7 @@ function civicrm_api3_job_get($params) {
  * @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);
 }
 
 /**
index 3faebbaa4bf0a0af8be4c8357a7a5bc59bbc36fc..b61843def29927992ce92ed9f433dd7aea2fe872 100644 (file)
@@ -64,7 +64,8 @@ function civicrm_api3_system_log_create($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);
 }
 
 /**
index 005c41846c49a6cb8b47f09e2699d1035d379403..493337cdbad57455f55a4423d48cac1e4858427c 100644 (file)
@@ -153,8 +153,7 @@ class api_v3_NoteTest extends CiviUnitTestCase {
     $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);
index e0eb54a8e9ed5e3b7313e7ec9e4ddd29d6fe9463..de89aff96a76b997390ac612b0fd6c597c4e2de7 100644 (file)
@@ -271,6 +271,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
       'MailSettings',
       'Setting',
       'MailingContact',
+      'SystemLog' //skip this because it doesn't make sense to update logs
     );
     if ($sequential === TRUE) {
       return $entitiesWithout;
index 4071bd38c337f642b8464f43a76bf04c70dfd6b2..3e04fc5bf70093ffe2f80a5c3567df6a9b9b65a1 100644 (file)
@@ -88,7 +88,9 @@ class api_v3_SystemTest extends CiviUnitTestCase {
    *
    * @access protected
    */
-  protected function tearDown() {}
+  protected function tearDown() {
+    $this->quickCleanup(array('civicrm_system_log'));
+  }
 
   ///////////////// civicrm_domain_get methods
 
@@ -122,4 +124,15 @@ class api_v3_SystemTest extends CiviUnitTestCase {
     $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'));
+  }
 }
index e88ef178659cf393e87febc0961cac5a8cb92491..6d2685ce2e586a67461085ce3e90f522390eb561 100644 (file)
@@ -130,7 +130,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
       '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');
   }