Merge pull request #17253 from mattwire/utf8convertblocksize
[civicrm-core.git] / tests / phpunit / CRM / Core / BAO / CustomValueTableTest.php
index 7256b4931db723abaa4871e2335d758b10e7bf0a..580df3134dfe958a899be8d0725e2a87bf90f5e1 100644 (file)
@@ -14,20 +14,20 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
    * 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'],
@@ -35,8 +35,8 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
         '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);
 
@@ -50,19 +50,19 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
    */
   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'],
@@ -70,8 +70,8 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
         '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);
 
@@ -86,17 +86,17 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
   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'],
@@ -104,8 +104,8 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
         '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);
 
@@ -118,20 +118,20 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
    * 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'],
@@ -139,8 +139,8 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
         '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);
 
@@ -153,19 +153,19 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
    * 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'],
@@ -173,8 +173,8 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
         '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);
 
@@ -188,19 +188,19 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
    */
   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'],
@@ -208,8 +208,8 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
         '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);
 
@@ -224,28 +224,28 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
   }
 
   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']]);