diff --git a/api/v3/Campaign.php b/api/v3/Campaign.php index 336d1eb4ef11..7ba0f54d38a4 100644 --- a/api/v3/Campaign.php +++ b/api/v3/Campaign.php @@ -49,7 +49,7 @@ * @access public */ function civicrm_api3_campaign_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Campaign'); } /** @@ -74,7 +74,7 @@ function _civicrm_api3_campaign_create_spec(&$params) { * {@getfields campaign_get} */ function civicrm_api3_campaign_get($params) { - return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Campaign'); } /** diff --git a/api/v3/Case.php b/api/v3/Case.php index 7450f7895219..4e8790baa3d4 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -228,7 +228,7 @@ function civicrm_api3_case_get($params) { } //search by contacts - if ($contact = CRM_Utils_Array::value('contact_id', $params)) { + if (($contact = CRM_Utils_Array::value('contact_id', $params)) != FALSE) { if (!is_numeric($contact)) { throw new API_Exception('Invalid parameter: contact_id. Must provide a numeric value.'); } diff --git a/api/v3/Relationship.php b/api/v3/Relationship.php index 6dfd75ac23fa..2a0959cfb68b 100644 --- a/api/v3/Relationship.php +++ b/api/v3/Relationship.php @@ -148,10 +148,9 @@ function civicrm_api3_relationship_get($params) { if(!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) { CRM_Contact_BAO_Relationship::membershipTypeToRelationshipTypes($params); } - $relationships = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE); + $relationships = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Relationship'); } else { - $relationships = array(); $relationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], CRM_Utils_Array::value('status_id', $params), 0, diff --git a/api/v3/Survey.php b/api/v3/Survey.php index 7e6a17d1dc33..bc12a4502f25 100644 --- a/api/v3/Survey.php +++ b/api/v3/Survey.php @@ -47,7 +47,7 @@ * @access public */ function civicrm_api3_survey_create($params) { - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Survey'); } /** @@ -72,7 +72,7 @@ function _civicrm_api3_survey_create_spec(&$params) { * @access public */ function civicrm_api3_survey_get($params) { - return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Survey'); } /** diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index ffa3495f8e24..5bb07b4d6472 100755 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -398,6 +398,7 @@ protected function setUp() { //flush component settings CRM_Core_Component::getEnabledComponents(TRUE); + if ($this->_eNoticeCompliant) { error_reporting(E_ALL); } diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index de12d1e0d447..14b12436f774 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -55,21 +55,15 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { /** Map custom group entities to civicrm components */ static $componentMap = array( - 'Contact' => NULL, - 'Individual' => NULL, - 'Household' => NULL, - 'Organization' => NULL, 'Contribution' => 'CiviContribute', 'Membership' => 'CiviMember', 'Participant' => 'CiviEvent', - 'Group' => NULL, - 'Relationship' => NULL, 'Event' => 'CiviEvent', 'Case' => 'CiviCase', - 'Activity' => NULL, 'Pledge' => 'CiviPledge', 'Grant' => 'CiviGrant', - 'Address' => NULL, + 'Campaign' => 'CiviCampaign', + 'Survey' => 'CiviCampaign', ); /* they are two types of missing APIs: @@ -183,17 +177,18 @@ public static function custom_data_entities_get() { * @return array */ public static function custom_data_entities() { - $enableComponents = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); $entities = CRM_Core_BAO_CustomQuery::$extendsMap; - $components = self::$componentMap; + $enabledComponents = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); $customDataEntities = array(); $invalidEntities = array('Individual', 'Organization', 'Household'); - $entitiesToFix = array('Case', 'Relationship'); + $entitiesToFix = array('Relationship'); foreach ($entities as $entityName => $entity ) { if(!in_array($entityName, $invalidEntities) - && !in_array($entityName, $entitiesToFix) - && (!empty($components[$entityName]) && in_array($components[$entityName], $enableComponents) || $components[$entityName] == NULL)) { - $customDataEntities[] = array($entityName ); + && !in_array($entityName, $entitiesToFix)) { + if(!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) { + CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]); + } + $customDataEntities[] = array($entityName); } } return $customDataEntities;