From f1d237437744ac0fabb286594ed6f96f230a607a Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Mon, 22 Jun 2015 12:44:33 +0200 Subject: [PATCH] CRM-16701 - little hack in testCreateSingleValueAlter. When this test changes the form_values of a SavedSearch, it should change it into a PHP-serialized array. Please see https://civicrm.stackexchange.com/questions/3437 for more information. ---------------------------------------- * CRM-16701: Create API for saved searches https://issues.civicrm.org/jira/browse/CRM-16701 --- tests/phpunit/api/v3/SyntaxConformanceTest.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 508bd60899..33b194acd2 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -1135,7 +1135,19 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { case CRM_Utils_Type::T_TEXT: 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 ($fieldName == 'form_values') { + // This is a hack for the SavedSearch API. It expects form_values + // to be a serialized array. + // If you want to fix this, you should definitely read this forum + // post. + // http://forum.civicrm.org/index.php/topic,33990.0.html + // See also my question on the CiviCRM Stack Exchange: + // https://civicrm.stackexchange.com/questions/3437 + $entity[$fieldName] = serialize(array('sort_name' => "SortName2{$counter}")); + } + else { + $entity[$fieldName] = substr('New String', 0, CRM_Utils_Array::Value('maxlength', $specs, 100)); + } break; case CRM_Utils_Type::T_INT: -- 2.25.1