diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 6cb84d25e28e..290676183aa1 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -81,6 +81,10 @@ class CRM_Core_DAO extends DB_DataObject { QUERY_FORMAT_WILDCARD = 1, QUERY_FORMAT_NO_QUOTES = 2, + /** + * No serialization. + */ + SERIALIZE_NONE = 0, /** * Serialized string separated by and bookended with VALUE_SEPARATOR */ diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 31254a4dc73f..c591954617d4 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -1136,6 +1136,7 @@ public static function getComponentSelectValues() { */ public static function fieldSerialization() { return [ + CRM_Core_DAO::SERIALIZE_NONE => 'none', CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND => 'separator_bookend', CRM_Core_DAO::SERIALIZE_SEPARATOR_TRIMMED => 'separator_trimmed', CRM_Core_DAO::SERIALIZE_JSON => 'json', diff --git a/tests/phpunit/CRM/Core/DAOTest.php b/tests/phpunit/CRM/Core/DAOTest.php index f5b871cc7fc3..5786a146de38 100644 --- a/tests/phpunit/CRM/Core/DAOTest.php +++ b/tests/phpunit/CRM/Core/DAOTest.php @@ -407,6 +407,9 @@ public function serializationMethods() { ]; $daoInfo = new ReflectionClass('CRM_Core_DAO'); foreach ($daoInfo->getConstants() as $constant => $val) { + if ($constant === 'SERIALIZE_NONE') { + continue; + } if ($constant === 'SERIALIZE_JSON' || $constant === 'SERIALIZE_PHP') { $constants[] = [$val, array_merge($simpleData, $complexData)]; } diff --git a/tests/phpunit/api/v3/CustomFieldTest.php b/tests/phpunit/api/v3/CustomFieldTest.php index 88e4ef20c7ff..7ea591384a16 100644 --- a/tests/phpunit/api/v3/CustomFieldTest.php +++ b/tests/phpunit/api/v3/CustomFieldTest.php @@ -73,10 +73,10 @@ public function testCustomFieldCreateWithEdit() { ]; $customField = $this->callAPIAndDocument('custom_field', 'create', $params, __FUNCTION__, __FILE__); - $params['id'] = $customField['id']; - $customField = $this->callAPISuccess('custom_field', 'create', $params); + $customField['label'] = 'Name2'; + $customFieldEdited = $this->callAPISuccess('custom_field', 'create', $customField); - $this->assertNotNull($customField['id']); + $this->assertNotNull($customFieldEdited['id']); } /**