+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* @param $entityName
*/
public function testCustomDataGet($entityName) {
+ if ($entityName === 'Note') {
+ $this->markTestIncomplete('Note can not be processed here because of a vagary in the note api, it adds entity_table=contact to the get params when id is not present - which makes sense almost always but kills this test');
+ }
$this->quickCleanup(array('civicrm_uf_match'));
$this->createLoggedInUser();// so subsidiary activities are created
$entitiesWithNamingIssues = [
- 'MailingComponent' => 'Component',
'SmsProvider' => 'Provider',
'AclRole' => 'EntityRole',
'MailingEventQueue' => 'Queue',
// We are not passing 'check_permissions' so the the more limited permissions *should* be
// ignored but per CRM-17700 there is a history of custom data applying permissions when it shouldn't.
CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM', 'view my contact');
+ $objects = $this->getMockableBAOObjects($entityName, 1);
+
+ // simple custom field
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $usableName . 'Test.php');
$customFieldName = 'custom_' . $ids['custom_field_id'];
- $objects = $this->getMockableBAOObjects($entityName, 1);
$params = array('id' => $objects[0]->id, 'custom_' . $ids['custom_field_id'] => "custom string");
$result = $this->callAPISuccess($entityName, 'create', $params);
-
$this->assertTrue(isset($result['id']), 'no id on ' . $entityName);
$getParams = array('id' => $result['id'], 'return' => array($customFieldName));
$check = $this->callAPISuccess($entityName, 'get', $getParams);
$this->assertTrue(!empty($check['values'][$check['id']][$customFieldName]), 'Custom data not present for ' . $entityName);
$this->assertEquals("custom string", $check['values'][$check['id']][$customFieldName], 'Custom data not present for ' . $entityName);
-
$this->customFieldDelete($ids['custom_field_id']);
$this->customGroupDelete($ids['custom_group_id']);
+
+ $ids2 = $this->entityCustomGroupWithSingleStringMultiSelectFieldCreate(__FUNCTION__, $usableName . 'Test.php');
+ $customFieldNameMultiSelect = 'custom_' . $ids2['custom_field_id'];
+ // String custom field, Multi-Select html type
+ foreach ($ids2['custom_field_group_options'] as $option_value => $option_label) {
+ $params = ['id' => $objects[0]->id, 'custom_' . $ids2['custom_field_id'] => $option_value];
+ $result = $this->callAPISuccess($entityName, 'create', $params);
+ $getParams = [$customFieldNameMultiSelect => $option_value, 'return' => [$customFieldNameMultiSelect]];
+ $this->callAPISuccessGetCount($entityName, $getParams, 1);
+ }
+
+ // cleanup
+ $this->customFieldDelete($ids2['custom_field_id']);
+ $this->customGroupDelete($ids2['custom_group_id']);
+
$this->callAPISuccess($entityName, 'delete', array('id' => $result['id']));
$this->quickCleanup(array('civicrm_uf_match'));
if (!empty($createdValue)) {
//api has special handling on these 2 fields for backward compatibility reasons
$entity['next_sched_contribution'] = $updateParams['next_sched_contribution_date'];
}
+ if (isset($updateParams['image'])) {
+ // Image field is passed through simplifyURL function so may be different, do the same here for comparison
+ $entity['image'] = CRM_Utils_String::simplifyURL($updateParams['image'], TRUE);
+ }
+ if (isset($updateParams['thumbnail'])) {
+ // Thumbnail field is passed through simplifyURL function so may be different, do the same here for comparison
+ $entity['thumbnail'] = CRM_Utils_String::simplifyURL($updateParams['thumbnail'], TRUE);
+ }
$update = $this->callAPISuccess($entityName, 'create', $updateParams);
$checkParams = array(