From: jitendrapurohit Date: Fri, 11 Sep 2015 13:17:33 +0000 (+0530) Subject: test fix for CRM-13160 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9559d77f3f620f02577d466c2698828fc558bf2b;p=civicrm-core.git test fix for CRM-13160 --- diff --git a/api/v3/MembershipType.php b/api/v3/MembershipType.php index 5d3f378f74..9317407206 100644 --- a/api/v3/MembershipType.php +++ b/api/v3/MembershipType.php @@ -81,7 +81,7 @@ function _civicrm_api3_membership_type_create_spec(&$params) { */ function civicrm_api3_membership_type_get($params) { $results = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); - if (!empty($results['values'])) { + if (!empty($results['values']) && is_array($results['values'])) { foreach ($results['values'] as &$item) { // Workaround for fields using nonstandard serialization foreach (array('relationship_type_id', 'relationship_direction') as $field) { diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 7f2108499d..e4eb861ef5 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -1154,6 +1154,9 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { case CRM_Utils_Type::T_LONGTEXT: case CRM_Utils_Type::T_EMAIL: $entity[$fieldName] = substr('New String', 0, CRM_Utils_Array::Value('maxlength', $specs, 100)); + if ($entityName == 'MembershipType' && in_array($fieldName, array('relationship_type_id', 'relationship_direction'))) { + $entity[$fieldName] = (array) $entity[$fieldName]; + } break; case CRM_Utils_Type::T_INT: