test fix for CRM-13160
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 11 Sep 2015 13:17:33 +0000 (18:47 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 11 Sep 2015 13:17:33 +0000 (18:47 +0530)
api/v3/MembershipType.php
tests/phpunit/api/v3/SyntaxConformanceTest.php

index 5d3f378f74b18c2312520a1c6a8cbe96d2247c02..9317407206a473cd715df30260959a9f7aa8a4ac 100644 (file)
@@ -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) {
index 7f2108499d9d3dd3a9267eb6732744adeb3b18f5..e4eb861ef5615213f74cc609fb3487739a256a5a 100644 (file)
@@ -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: