* Test store function for country.
*/
public function testStoreCountry() {
- $params = array();
+ $params = [];
$contactID = $this->individualCreate();
$customGroup = $this->customGroupCreate();
- $fields = array(
+ $fields = [
'custom_group_id' => $customGroup['id'],
'data_type' => 'Country',
'html_type' => 'Select Country',
'default_value' => '',
- );
+ ];
$customField = $this->customFieldCreate($fields);
- $params[] = array(
- $customField['id'] => array(
+ $params[] = [
+ $customField['id'] => [
'value' => 1228,
'type' => 'Country',
'custom_field_id' => $customField['id'],
'table_name' => $customGroup['values'][$customGroup['id']]['table_name'],
'column_name' => $customField['values'][$customField['id']]['column_name'],
'file_id' => '',
- ),
- );
+ ],
+ ];
CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID);
*/
public function testStoreFile() {
$contactID = $this->individualCreate();
- $file = $this->callAPISuccess('File', 'create', array('uri' => 'dummy_data'));
+ $file = $this->callAPISuccess('File', 'create', ['uri' => 'dummy_data']);
$customGroup = $this->customGroupCreate();
- $fields = array(
+ $fields = [
'custom_group_id' => $customGroup['id'],
'data_type' => 'File',
'html_type' => 'File',
'default_value' => '',
- );
+ ];
$customField = $this->customFieldCreate($fields);
- $params[] = array(
- $customField['id'] => array(
+ $params[] = [
+ $customField['id'] => [
'value' => 'i/contact_house.png',
'type' => 'File',
'custom_field_id' => $customField['id'],
'table_name' => $customGroup['values'][$customGroup['id']]['table_name'],
'column_name' => $customField['values'][$customField['id']]['column_name'],
'file_id' => $file['id'],
- ),
- );
+ ],
+ ];
CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID);
public function testStoreStateProvince() {
$contactID = $this->individualCreate();
$customGroup = $this->customGroupCreate();
- $fields = array(
+ $fields = [
'custom_group_id' => $customGroup['id'],
'data_type' => 'StateProvince',
'html_type' => 'Select State/Province',
'default_value' => '',
- );
+ ];
$customField = $this->customFieldCreate($fields);
- $params[] = array(
- $customField['id'] => array(
+ $params[] = [
+ $customField['id'] => [
'value' => 1029,
'type' => 'StateProvince',
'custom_field_id' => $customField['id'],
'table_name' => $customGroup['values'][$customGroup['id']]['table_name'],
'column_name' => $customField['values'][$customField['id']]['column_name'],
'file_id' => 1,
- ),
- );
+ ],
+ ];
CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID);
* Test store function for date.
*/
public function testStoreDate() {
- $params = array();
+ $params = [];
$contactID = $this->individualCreate();
$customGroup = $this->customGroupCreate();
- $fields = array(
+ $fields = [
'custom_group_id' => $customGroup['id'],
'data_type' => 'Date',
'html_type' => 'Select Date',
'default_value' => '',
- );
+ ];
$customField = $this->customFieldCreate($fields);
- $params[] = array(
- $customField['id'] => array(
+ $params[] = [
+ $customField['id'] => [
'value' => '20080608000000',
'type' => 'Date',
'custom_field_id' => $customField['id'],
'table_name' => $customGroup['values'][$customGroup['id']]['table_name'],
'column_name' => $customField['values'][$customField['id']]['column_name'],
'file_id' => '',
- ),
- );
+ ],
+ ];
CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID);
* Test store function for rich text editor.
*/
public function testStoreRichTextEditor() {
- $params = array();
+ $params = [];
$contactID = $this->individualCreate();
$customGroup = $this->customGroupCreate();
- $fields = array(
+ $fields = [
'custom_group_id' => $customGroup['id'],
'html_type' => 'RichTextEditor',
'data_type' => 'Memo',
- );
+ ];
$customField = $this->customFieldCreate($fields);
- $params[] = array(
- $customField['id'] => array(
+ $params[] = [
+ $customField['id'] => [
'value' => '<p><strong>This is a <u>test</u></p>',
'type' => 'Memo',
'custom_field_id' => $customField['id'],
'table_name' => $customGroup['values'][$customGroup['id']]['table_name'],
'column_name' => $customField['values'][$customField['id']]['column_name'],
'file_id' => '',
- ),
- );
+ ],
+ ];
CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID);
*/
public function testGetEntityValues() {
- $params = array();
+ $params = [];
$contactID = $this->individualCreate();
- $customGroup = $this->customGroupCreate(array('extends' => 'Individual'));
- $fields = array(
+ $customGroup = $this->customGroupCreate(['extends' => 'Individual']);
+ $fields = [
'custom_group_id' => $customGroup['id'],
'html_type' => 'RichTextEditor',
'data_type' => 'Memo',
- );
+ ];
$customField = $this->customFieldCreate($fields);
- $params[] = array(
- $customField['id'] => array(
+ $params[] = [
+ $customField['id'] => [
'value' => '<p><strong>This is a <u>test</u></p>',
'type' => 'Memo',
'custom_field_id' => $customField['id'],
'table_name' => $customGroup['values'][$customGroup['id']]['table_name'],
'column_name' => $customField['values'][$customField['id']]['column_name'],
'file_id' => '',
- ),
- );
+ ],
+ ];
CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID);
}
public function testCustomGroupMultiple() {
- $params = array();
+ $params = [];
$contactID = $this->individualCreate();
$customGroup = $this->customGroupCreate();
- $fields = array(
+ $fields = [
'custom_group_id' => $customGroup['id'],
'data_type' => 'String',
'html_type' => 'Text',
- );
+ ];
$customField = $this->customFieldCreate($fields);
- $params = array(
+ $params = [
'entityID' => $contactID,
'custom_' . $customField['id'] . '_-1' => 'First String',
- );
+ ];
$error = CRM_Core_BAO_CustomValueTable::setValues($params);
- $newParams = array(
+ $newParams = [
'entityID' => $contactID,
'custom_' . $customField['id'] => 1,
- );
+ ];
$result = CRM_Core_BAO_CustomValueTable::getValues($newParams);
$this->assertEquals($params['custom_' . $customField['id'] . '_-1'], $result['custom_' . $customField['id']]);