CRM-15168 actually - extended test to cover all actions isn't too big a thing
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 25 Aug 2014 02:06:25 +0000 (14:06 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 25 Aug 2014 06:06:32 +0000 (18:06 +1200)
api/v3/Constant.php
api/v3/Contact.php
api/v3/Contribution.php
api/v3/CustomValue.php
api/v3/Generic.php
api/v3/Mailing.php
api/v3/MailingContact.php
api/v3/Participant.php
api/v3/Profile.php
tests/phpunit/api/v3/SyntaxConformanceTest.php

index f7dcd5e276a161643fe352ac412a6144ea9448a5..328dfbad4a9cd5850a229dbd3d5270da384e64ce 100644 (file)
@@ -135,6 +135,7 @@ function _civicrm_api3_constant_get_spec(&$params) {
 
   $params = (array
     ('name' => array(
+      'title' => 'Constant Name',
       'api.required' => 1,
         'options' =>
           'activityStatus',
index 4ec440ef9b27c2766ff28e20de00a8fb8ff77eea..59e1c38e31e511a323f108c9a67328a55f17f5b6 100644 (file)
@@ -877,8 +877,11 @@ function civicrm_api3_contact_merge($params) {
  */
 function _civicrm_api3_contact_proximity_spec(&$params) {
   $params['latitude']['api.required'] = 1;
+  $params['latitude']['title'] = 'Latitude';
   $params['longitude']['api.required'] = 1;
+  $params['longitude']['title'] = 'Longitude';
   $params['unit']['api.default'] = 'meter';
+  $params['unit']['title'] = 'Unit of Measurement';
 }
 
 /**
index 0b5b5acc2b164a06082acf14b132d08ec3097846..1ef6e4d97ae19014cc7df1ec60c73361376734e9 100644 (file)
@@ -216,6 +216,7 @@ function _civicrm_api3_format_soft_credit(&$contribution) {
  */
 function _civicrm_api3_contribution_get_spec(&$params) {
   $params['contribution_test']['api.default'] = 0;
+  $params['contribution_test']['title'] = 'Get Test Contributions?';
   $params['financial_type_id']['api.aliases'] = array('contribution_type_id');
   $params['contact_id'] = $params['contribution_contact_id'];
   $params['contact_id']['api.aliases'] = array('contribution_contact_id');
@@ -249,8 +250,8 @@ function _civicrm_api3_contribute_format_params($params, &$values, $create = FAL
  * @param array $params array or parameters determined by getfields
  */
 function _civicrm_api3_contribution_transact_spec(&$params) {
-  // This function calls create, so should inherit create spec
-  _civicrm_api3_contribution_create_spec($params);
+  $fields = civicrm_api3('contribution', 'getfields', array('action' => 'create'));
+  $params = array_merge($params, $fields['values']);
   $params['receive_date']['api.default'] = 'now';
 }
 
index a2d46c8ff484f433c4786c69faa8733a04b62063..6a2cdd86c0d8c68afc48c5c36d078fb531086293 100644 (file)
@@ -236,4 +236,5 @@ function civicrm_api3_custom_value_get($params) {
  */
 function _civicrm_api3_custom_value_get_spec(&$params) {
   $params['entity_id']['api.required'] = 1;
+  $params['entity_id']['title'] = 'Entity ID';
 }
index 75db68b6027deddbd771dc5fd4b97164cc0cc88d..a6559f39df2ffdfd4833b7fe1fccca0781b80d85 100644 (file)
@@ -215,6 +215,7 @@ function civicrm_api3_generic_getvalue($apiRequest) {
  */
 function _civicrm_api3_generic_getrefcount_spec(&$params) {
   $params['id']['api.required'] = 1;
+  $params['id']['title'] = 'Entity ID';
 }
 
 /**
index c24c6d6a8e552ae0b5450974f9f220cebba5da23..62bac6e3089cbdd572d37c2df411c8c797327dc5 100644 (file)
@@ -124,9 +124,13 @@ function civicrm_api3_mailing_event_bounce($params) {
  */
 function _civicrm_api3_mailing_event_bounce_spec(&$params) {
   $params['job_id']['api.required'] = 1;
+  $params['job_id']['title'] = 'Job ID';
   $params['event_queue_id']['api.required'] = 1;
+  $params['event_queue_id']['title'] = 'Event Queue ID';
   $params['hash']['api.required'] = 1;
+  $params['hash']['title'] = 'Hash';
   $params['body']['api.required'] = 1;
+  $params['body']['title'] = 'Body';
 }
 
 /**
@@ -176,9 +180,13 @@ function civicrm_api3_mailing_event_reply($params) {
  */
 function _civicrm_api3_mailing_event_reply_spec(&$params) {
   $params['job_id']['api.required'] = 1;
+  $params['job_id']['title'] = 'Job ID';
   $params['event_queue_id']['api.required'] = 1;
+  $params['event_queue_id']['title'] = 'Event Queue ID';
   $params['hash']['api.required'] = 1;
+  $params['hash']['title'] = 'Hash';
   $params['replyTo']['api.required'] = 0;
+  $params['replyTo']['title'] = 'Reply To';//doesn't really explain adequately
 }
 
 /**
@@ -213,9 +221,13 @@ function civicrm_api3_mailing_event_forward($params) {
  */
 function _civicrm_api3_mailing_event_forward_spec(&$params) {
   $params['job_id']['api.required'] = 1;
+  $params['job_id']['title'] = 'Job ID';
   $params['event_queue_id']['api.required'] = 1;
+  $params['event_queue_id']['title'] = 'Event Queue ID';
   $params['hash']['api.required'] = 1;
+  $params['hash']['title'] = 'Hash';
   $params['email']['api.required'] = 1;
+  $params['email']['title'] = 'Forwarded to Email';
 }
 
 /**
index 8e342e0c82a852293d4d257ceba3f163dca5f1f6..39d978c4b9bb6e1d169351a32c8dfa13a24f966f 100644 (file)
@@ -82,8 +82,10 @@ function _civicrm_api3_mailing_contact_getresults($params, $count){
  */
 function _civicrm_api3_mailing_contact_get_spec(&$params) {
   $params['contact_id']['api.required'] = 1;
+  $params['contact_id']['title'] = 'Contact ID';
   $params['type'] = array(
     'api.default' => 'Delivered',
+    'title' => 'Type',// doesn't really explain the field - but not sure I understand it to explain it better
     'type' => CRM_Utils_Type::T_STRING,
     'options' => array(
       'Delivered' => 'Delivered',
index 21c5efd16394d39decde7454992d9d2cae4c4a48..3396f7280d250e3cde6eeced583ce56598967237 100644 (file)
@@ -188,6 +188,7 @@ function civicrm_api3_participant_get($params) {
  */
 function _civicrm_api3_participant_get_spec(&$params) {
   $params['participant_test']['api.default'] = 0;
+  $params['participant_test']['title'] = 'Get Test Participants';
 }
 
 /**
index 7ed5c434da0e09cf4f458d603c3b81636a094404..08a1914d5e6a2951187d05f3ea804412f7e8bf3b 100644 (file)
@@ -143,7 +143,9 @@ function civicrm_api3_profile_get($params) {
  */
 function _civicrm_api3_profile_get_spec(&$params) {
   $params['profile_id']['api.required'] = TRUE;
+  $params['profile_id']['title'] = 'Profile ID';
   $params['contact_id']['description'] = 'If no contact is specified an array of defaults will be returned';
+  $params['contact_id']['title'] = 'Contact ID';
 }
 
 /**
@@ -320,6 +322,7 @@ function _civicrm_api3_profile_submit_spec(&$params, $apirequest) {
     _civicrm_api3_buildprofile_submitfields(FALSE, FALSE, True);
   }
   $params['profile_id']['api.required'] = TRUE;
+  $params['profile_id']['title'] = 'Profile ID';
 }
 
 /**
index bd65c3865138121169f3d49ee61966b97bad8374..97f1145a1d2b3369cb9120ce02110d694dca6cdb 100644 (file)
@@ -1134,16 +1134,18 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
     if (in_array($entity, $entities)) {
       $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $entity . 'Test.php');
     }
-    $fields = $this->callAPISuccess($entity, 'getfields', array('action' => 'create'));
-    if (!empty($ids)) {
-      $this->assertArrayHasKey('custom_' . $ids['custom_field_id'], $fields['values']);
-    }
+    $actions =  $this->callAPISuccess($entity, 'getactions', array());
+    foreach ($actions['values'] as $action) {
+      $fields = $this->callAPISuccess($entity, 'getfields', array('action' => $action));
+      if (!empty($ids) && in_array($action, array('create', 'get'))) {
+          $this->assertArrayHasKey('custom_' . $ids['custom_field_id'], $fields['values']);
+      }
 
-    foreach ($fields['values'] as $fieldName => $fieldSpec) {
-      $this->assertArrayHasKey('title', $fieldSpec, "no title for $entity - $fieldName");
-      $this->assertNotEmpty($fieldSpec['title'], "empty title for $entity - $fieldName");
+      foreach ($fields['values'] as $fieldName => $fieldSpec) {
+        $this->assertArrayHasKey('title', $fieldSpec, "no title for $entity - $fieldName on action $action");
+        $this->assertNotEmpty($fieldSpec['title'], "empty title for $entity - $fieldName");
+      }
     }
-
     if (!empty($ids)) {
       $this->customFieldDelete($ids['custom_field_id']);
       $this->customGroupDelete($ids['custom_group_id']);