From: Eileen McNaughton Date: Mon, 25 Aug 2014 02:06:25 +0000 (+1200) Subject: CRM-15168 actually - extended test to cover all actions isn't too big a thing X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4c41ecb22860f6987de129934da4979e115a9a35;p=civicrm-core.git CRM-15168 actually - extended test to cover all actions isn't too big a thing --- diff --git a/api/v3/Constant.php b/api/v3/Constant.php index f7dcd5e276..328dfbad4a 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -135,6 +135,7 @@ function _civicrm_api3_constant_get_spec(&$params) { $params = (array ('name' => array( + 'title' => 'Constant Name', 'api.required' => 1, 'options' => 'activityStatus', diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 4ec440ef9b..59e1c38e31 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -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'; } /** diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 0b5b5acc2b..1ef6e4d97a 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -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'; } diff --git a/api/v3/CustomValue.php b/api/v3/CustomValue.php index a2d46c8ff4..6a2cdd86c0 100644 --- a/api/v3/CustomValue.php +++ b/api/v3/CustomValue.php @@ -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'; } diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 75db68b602..a6559f39df 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -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'; } /** diff --git a/api/v3/Mailing.php b/api/v3/Mailing.php index c24c6d6a8e..62bac6e308 100644 --- a/api/v3/Mailing.php +++ b/api/v3/Mailing.php @@ -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'; } /** diff --git a/api/v3/MailingContact.php b/api/v3/MailingContact.php index 8e342e0c82..39d978c4b9 100644 --- a/api/v3/MailingContact.php +++ b/api/v3/MailingContact.php @@ -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', diff --git a/api/v3/Participant.php b/api/v3/Participant.php index 21c5efd163..3396f7280d 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -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'; } /** diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 7ed5c434da..08a1914d5e 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -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'; } /** diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index bd65c38651..97f1145a1d 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -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']);