From a25b46e9d724ebc8a2b4f02a6c0ef49f853c749a Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 19 Feb 2018 15:17:10 +1300 Subject: [PATCH] Fix more entities to support custom fields (via api) --- api/v3/AclRole.php | 2 +- api/v3/CaseContact.php | 2 +- api/v3/ContributionProduct.php | 2 +- api/v3/ContributionSoft.php | 2 +- api/v3/Dashboard.php | 6 +- api/v3/DashboardContact.php | 2 +- api/v3/EntityBatch.php | 2 +- api/v3/EntityFinancialTrxn.php | 2 +- api/v3/Im.php | 2 +- api/v3/Job.php | 2 +- api/v3/LocationType.php | 2 +- api/v3/MailSettings.php | 2 +- api/v3/MailingAB.php | 2 +- api/v3/MailingComponent.php | 2 +- api/v3/MailingEventQueue.php | 2 +- api/v3/MappingField.php | 2 +- api/v3/MembershipLog.php | 2 +- api/v3/MembershipPayment.php | 2 +- api/v3/MessageTemplate.php | 2 +- api/v3/Navigation.php | 2 +- api/v3/Note.php | 2 +- api/v3/OpenID.php | 2 +- api/v3/OptionGroup.php | 2 +- api/v3/OptionValue.php | 2 +- api/v3/ParticipantStatusType.php | 2 +- api/v3/Premium.php | 2 +- api/v3/PrintLabel.php | 2 +- api/v3/Product.php | 2 +- api/v3/ReportInstance.php | 2 +- api/v3/RuleGroup.php | 2 +- api/v3/SavedSearch.php | 2 +- api/v3/SmsProvider.php | 2 +- api/v3/StateProvince.php | 2 +- .../phpunit/api/v3/SyntaxConformanceTest.php | 101 ++++++++++++++++-- 34 files changed, 123 insertions(+), 48 deletions(-) diff --git a/api/v3/AclRole.php b/api/v3/AclRole.php index b1708533b7..36f570df60 100644 --- a/api/v3/AclRole.php +++ b/api/v3/AclRole.php @@ -40,7 +40,7 @@ * API result array */ function civicrm_api3_acl_role_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'AclRole'); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityRole'); } /** diff --git a/api/v3/CaseContact.php b/api/v3/CaseContact.php index 4898d6308c..c121abc7da 100644 --- a/api/v3/CaseContact.php +++ b/api/v3/CaseContact.php @@ -39,7 +39,7 @@ * @return array */ function civicrm_api3_case_contact_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'CaseContact'); } /** diff --git a/api/v3/ContributionProduct.php b/api/v3/ContributionProduct.php index a372bf871d..86efc7bd96 100644 --- a/api/v3/ContributionProduct.php +++ b/api/v3/ContributionProduct.php @@ -43,7 +43,7 @@ * @return array */ function civicrm_api3_contribution_product_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ContributionProduct'); } /** diff --git a/api/v3/ContributionSoft.php b/api/v3/ContributionSoft.php index 5c4daf3a94..aafe6023e6 100644 --- a/api/v3/ContributionSoft.php +++ b/api/v3/ContributionSoft.php @@ -41,7 +41,7 @@ * API result array */ function civicrm_api3_contribution_soft_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ContributionSoft'); } /** diff --git a/api/v3/Dashboard.php b/api/v3/Dashboard.php index cf5aae7b2f..01c1e43cd1 100644 --- a/api/v3/Dashboard.php +++ b/api/v3/Dashboard.php @@ -73,11 +73,7 @@ function _civicrm_api3_dashboard_create_spec(&$params) { * @return array */ function civicrm_api3_dashboard_get($params) { - // NEVER COPY THIS. No idea why a newish api would not use basic_get. - $bao = new CRM_Core_BAO_Dashboard(); - _civicrm_api3_dao_set_filter($bao, $params, TRUE); - $dashlets = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'Dashboard'); - return civicrm_api3_create_success($dashlets, $params, 'Dashboard', 'get', $bao); + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** diff --git a/api/v3/DashboardContact.php b/api/v3/DashboardContact.php index e67fef5f6e..7a1d9b3711 100644 --- a/api/v3/DashboardContact.php +++ b/api/v3/DashboardContact.php @@ -51,7 +51,7 @@ function civicrm_api3_dashboard_contact_create($params) { if ($errors !== NULL) { return $errors; } - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'DashboardContact'); } /** diff --git a/api/v3/EntityBatch.php b/api/v3/EntityBatch.php index 4418bce80c..7dae97a0e3 100644 --- a/api/v3/EntityBatch.php +++ b/api/v3/EntityBatch.php @@ -66,7 +66,7 @@ function _civicrm_api3_entity_batch_create_spec(&$params) { * @return array */ function civicrm_api3_entity_batch_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityBatch'); } /** diff --git a/api/v3/EntityFinancialTrxn.php b/api/v3/EntityFinancialTrxn.php index 0c0e7b1578..5ddd6c30a5 100644 --- a/api/v3/EntityFinancialTrxn.php +++ b/api/v3/EntityFinancialTrxn.php @@ -39,7 +39,7 @@ * @return array */ function civicrm_api3_entity_financial_trxn_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityFinancialTrxn'); } /** diff --git a/api/v3/Im.php b/api/v3/Im.php index 7630989d4c..e78bf04812 100644 --- a/api/v3/Im.php +++ b/api/v3/Im.php @@ -39,7 +39,7 @@ * @return array */ function civicrm_api3_im_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'IM'); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Im'); } /** diff --git a/api/v3/Job.php b/api/v3/Job.php index 1d21b34965..e9e9306691 100644 --- a/api/v3/Job.php +++ b/api/v3/Job.php @@ -58,7 +58,7 @@ function _civicrm_api3_job_create_spec(&$params) { * @return array */ function civicrm_api3_job_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Job'); } /** diff --git a/api/v3/LocationType.php b/api/v3/LocationType.php index 49b124f0d3..bd419d8711 100644 --- a/api/v3/LocationType.php +++ b/api/v3/LocationType.php @@ -45,7 +45,7 @@ function civicrm_api3_location_type_create($params) { $params['display_name'] = $params['name']; } - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'LocationType'); } /** diff --git a/api/v3/MailSettings.php b/api/v3/MailSettings.php index 54743ad179..112a175e9f 100644 --- a/api/v3/MailSettings.php +++ b/api/v3/MailSettings.php @@ -41,7 +41,7 @@ * API result array. */ function civicrm_api3_mail_settings_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailSettings'); } /** diff --git a/api/v3/MailingAB.php b/api/v3/MailingAB.php index e0ca07424a..542ced9213 100644 --- a/api/v3/MailingAB.php +++ b/api/v3/MailingAB.php @@ -50,7 +50,7 @@ function _civicrm_api3_mailing_a_b_create_spec(&$spec) { * API Success Array */ function civicrm_api3_mailing_a_b_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingAB'); } /** diff --git a/api/v3/MailingComponent.php b/api/v3/MailingComponent.php index 811d3b5b21..e05491edce 100644 --- a/api/v3/MailingComponent.php +++ b/api/v3/MailingComponent.php @@ -41,7 +41,7 @@ * API result array. */ function civicrm_api3_mailing_component_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Component'); } diff --git a/api/v3/MailingEventQueue.php b/api/v3/MailingEventQueue.php index 8592a8d364..a1a3f8de84 100644 --- a/api/v3/MailingEventQueue.php +++ b/api/v3/MailingEventQueue.php @@ -50,7 +50,7 @@ function civicrm_api3_mailing_event_queue_create($params) { array('job_id', 'contact_id'), FALSE ); - return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params); + return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params, 'Queue'); } /** diff --git a/api/v3/MappingField.php b/api/v3/MappingField.php index 4dc8778762..88d257bc9c 100644 --- a/api/v3/MappingField.php +++ b/api/v3/MappingField.php @@ -40,7 +40,7 @@ * @return array */ function civicrm_api3_mapping_field_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MappingField'); } /** diff --git a/api/v3/MembershipLog.php b/api/v3/MembershipLog.php index 89d58c442c..cd5dd6ad7b 100644 --- a/api/v3/MembershipLog.php +++ b/api/v3/MembershipLog.php @@ -41,7 +41,7 @@ * API result array. */ function civicrm_api3_membership_log_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MembershipLog'); } /** diff --git a/api/v3/MembershipPayment.php b/api/v3/MembershipPayment.php index 05277f11d6..3f13154fb0 100644 --- a/api/v3/MembershipPayment.php +++ b/api/v3/MembershipPayment.php @@ -42,7 +42,7 @@ * API result array. */ function civicrm_api3_membership_payment_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MembershipPayment'); } /** diff --git a/api/v3/MessageTemplate.php b/api/v3/MessageTemplate.php index a8557538a8..8c4c755418 100644 --- a/api/v3/MessageTemplate.php +++ b/api/v3/MessageTemplate.php @@ -40,7 +40,7 @@ * @throws \API_Exception */ function civicrm_api3_message_template_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MessageTemplate'); } /** diff --git a/api/v3/Navigation.php b/api/v3/Navigation.php index e4070ef164..fb040d2c65 100644 --- a/api/v3/Navigation.php +++ b/api/v3/Navigation.php @@ -109,7 +109,7 @@ function _civicrm_api3_navigation_create_spec(&$params) { */ function civicrm_api3_navigation_create($params) { civicrm_api3_verify_one_mandatory($params, NULL, array('name', 'label')); - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Navigation'); } /** diff --git a/api/v3/Note.php b/api/v3/Note.php index 70f73c5b2f..d08d6e37f0 100644 --- a/api/v3/Note.php +++ b/api/v3/Note.php @@ -44,7 +44,7 @@ * API result array */ function civicrm_api3_note_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Note'); } /** diff --git a/api/v3/OpenID.php b/api/v3/OpenID.php index cff85e2928..d338a24290 100644 --- a/api/v3/OpenID.php +++ b/api/v3/OpenID.php @@ -40,7 +40,7 @@ * API result array */ function civicrm_api3_open_i_d_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OpenID'); } /** diff --git a/api/v3/OptionGroup.php b/api/v3/OptionGroup.php index 58942efa59..e20cced41f 100644 --- a/api/v3/OptionGroup.php +++ b/api/v3/OptionGroup.php @@ -53,7 +53,7 @@ function civicrm_api3_option_group_get($params) { * @return array */ function civicrm_api3_option_group_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OptionGroup'); } /** diff --git a/api/v3/OptionValue.php b/api/v3/OptionValue.php index a10cb899c9..e833334670 100644 --- a/api/v3/OptionValue.php +++ b/api/v3/OptionValue.php @@ -42,7 +42,7 @@ * API result array */ function civicrm_api3_option_value_get($params) { - return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OptionValue'); } /** diff --git a/api/v3/ParticipantStatusType.php b/api/v3/ParticipantStatusType.php index 22ea6081b9..ea74bbf593 100644 --- a/api/v3/ParticipantStatusType.php +++ b/api/v3/ParticipantStatusType.php @@ -45,7 +45,7 @@ * participant_status array */ function civicrm_api3_participant_status_type_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ParticipantStatusType'); } /** diff --git a/api/v3/Premium.php b/api/v3/Premium.php index 5f3a8f41ea..066e6e9a9b 100644 --- a/api/v3/Premium.php +++ b/api/v3/Premium.php @@ -44,7 +44,7 @@ * @return array */ function civicrm_api3_premium_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Premium'); } /** diff --git a/api/v3/PrintLabel.php b/api/v3/PrintLabel.php index 54ad27ccc2..c436a853c2 100644 --- a/api/v3/PrintLabel.php +++ b/api/v3/PrintLabel.php @@ -39,7 +39,7 @@ * @return array */ function civicrm_api3_print_label_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PrintLabel'); } /** diff --git a/api/v3/Product.php b/api/v3/Product.php index e862b28449..a60e19bad0 100644 --- a/api/v3/Product.php +++ b/api/v3/Product.php @@ -43,7 +43,7 @@ * @return array */ function civicrm_api3_product_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Product'); } /** diff --git a/api/v3/ReportInstance.php b/api/v3/ReportInstance.php index 97679be0ed..cb8c618e55 100644 --- a/api/v3/ReportInstance.php +++ b/api/v3/ReportInstance.php @@ -53,7 +53,7 @@ function civicrm_api3_report_instance_get($params) { * API result array */ function civicrm_api3_report_instance_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ReportInstance'); } /** diff --git a/api/v3/RuleGroup.php b/api/v3/RuleGroup.php index 68a0f9ef41..d8abd0a8b3 100644 --- a/api/v3/RuleGroup.php +++ b/api/v3/RuleGroup.php @@ -43,7 +43,7 @@ * API result array */ function civicrm_api3_rule_group_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'RuleGroup'); } /** diff --git a/api/v3/SavedSearch.php b/api/v3/SavedSearch.php index e32c258e35..ec9538601d 100644 --- a/api/v3/SavedSearch.php +++ b/api/v3/SavedSearch.php @@ -60,7 +60,7 @@ function civicrm_api3_saved_search_create($params) { } } - $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'SavedSearch'); _civicrm_api3_saved_search_result_cleanup($result); return $result; } diff --git a/api/v3/SmsProvider.php b/api/v3/SmsProvider.php index fc45ebb241..c445c4ed76 100644 --- a/api/v3/SmsProvider.php +++ b/api/v3/SmsProvider.php @@ -39,7 +39,7 @@ * @return array */ function civicrm_api3_sms_provider_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Provider'); } /** diff --git a/api/v3/StateProvince.php b/api/v3/StateProvince.php index b07d41cb42..2044cf98b3 100644 --- a/api/v3/StateProvince.php +++ b/api/v3/StateProvince.php @@ -42,7 +42,7 @@ * @throws \API_Exception */ function civicrm_api3_state_province_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_DAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_DAO(__FUNCTION__), $params, 'StateProvince'); } /** diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 2da4956084..d0084ec63d 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -267,12 +267,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * @return array */ public static function custom_data_incl_non_std_entities_get() { - $customDataEntities = self::custom_data_entities(); - $customDataEntities[] = ['UFGroup']; - $customDataEntities[] = ['PriceSet']; - $customDataEntities[] = ['PaymentToken']; - $customDataEntities[] = ['Mailing']; - return $customDataEntities; + return static::entities(static::toBeSkipped_custom_data_creatable(TRUE)); } /** @@ -371,6 +366,77 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { return $entities; } + /** + * @param bool $sequential + * + * @return array + */ + public static function toBeSkipped_custom_data_creatable($sequential = FALSE) { + $entitiesWithout = array( + // Ones to fix. + 'CaseContact', + 'CustomField', + 'CustomGroup', + 'DashboardContact', + 'Domain', + 'File', + 'FinancialType', + 'LocBlock', + 'MailingEventConfirm', + 'MailingEventResubscribe', + 'MailingEventSubscribe', + 'MailingEventUnsubscribe', + 'MailingJob', + 'MembershipPayment', + 'Note', + 'SavedSearch', + 'UFJoin', + 'UFField', + 'PriceFieldValue', + 'Website', + 'JobLog', + 'GroupContact', + 'EntityTag', + 'PledgePayment', + 'PaymentProcessorType', + 'Relationship', + 'RelationshipType', + 'ParticipantPayment', + + // ones that are not real entities hence not extendable. + 'ActivityType', + 'Entity', + 'Cxn', + 'Constant', + 'Attachment', + 'CustomSearch', + 'CustomValue', + 'CxnApp', + 'Extension', + 'MailingContact', + 'User', + 'System', + 'Setting', + 'SystemLog', + 'ReportTemplate', + 'MailingRecipients', + 'SurveyRespondant', + 'Profile', + 'Payment', + 'Order', + 'MailingGroup', + 'Logging', + ); + if ($sequential === TRUE) { + return $entitiesWithout; + } + $entities = array(); + foreach ($entitiesWithout as $e) { + $entities[] = array($e); + } + return $entities; + } + /** * @param bool $sequential * @@ -784,27 +850,40 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * @param $entityName */ public function testCustomDataGet($entityName) { + $this->quickCleanup(array('civicrm_uf_match')); $this->createLoggedInUser();// so subsidiary activities are created + $entitiesWithNamingIssues = [ + 'MailingComponent' => 'Component', + 'SmsProvider' => 'Provider', + 'AclRole' => 'EntityRole', + 'MailingEventQueue' => 'Queue', + ]; + + $usableName = !empty($entitiesWithNamingIssues[$entityName]) ? $entitiesWithNamingIssues[$entityName] : $entityName; + $optionName = CRM_Core_DAO_AllCoreTables::getTableForClass(CRM_Core_DAO_AllCoreTables::getFullName($usableName)); + if (!isset(CRM_Core_BAO_CustomQuery::$extendsMap[$entityName])) { $createdValue = $this->callAPISuccess('OptionValue', 'create', [ 'option_group_id' => 'cg_extend_objects', - 'label' => $entityName, - 'value' => $entityName, - 'name' => CRM_Core_DAO_AllCoreTables::getTableForClass(CRM_Core_DAO_AllCoreTables::getFullName($entityName)), + 'label' => $usableName, + 'value' => $usableName, + 'name' => $optionName, ]); } // We are not passing 'check_permissions' so the the more limited permissions *should* be // ignored but per CRM-17700 there is a history of custom data applying permissions when it shouldn't. CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM', 'view my contact'); - $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $entityName . 'Test.php'); + $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $usableName . 'Test.php'); $customFieldName = 'custom_' . $ids['custom_field_id']; $objects = $this->getMockableBAOObjects($entityName, 1); $params = array('id' => $objects[0]->id, 'custom_' . $ids['custom_field_id'] => "custom string"); $result = $this->callAPISuccess($entityName, 'create', $params); + $this->assertTrue(isset($result['id']), 'no id on ' . $entityName); $getParams = array('id' => $result['id'], 'return' => array($customFieldName)); $check = $this->callAPISuccess($entityName, 'get', $getParams); + $this->assertTrue(!empty($check['values'][$check['id']][$customFieldName]), 'Custom data not present for ' . $entityName); $this->assertEquals("custom string", $check['values'][$check['id']][$customFieldName], 'Custom data not present for ' . $entityName); $this->customFieldDelete($ids['custom_field_id']); @@ -1464,7 +1543,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * @throws \PHPUnit_Framework_IncompleteTestError */ public function testInvalidID_delete($Entity) { - $result = $this->callAPIFailure($Entity, 'Delete', array('id' => 999)); + $result = $this->callAPIFailure($Entity, 'Delete', array('id' => 999999)); } /** -- 2.25.1