CRM-20508: test fix for non-ascii chars in custom field
authorJitendra Purohit <jitendra@fuzion.co.nz>
Thu, 11 May 2017 13:40:17 +0000 (19:10 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Thu, 11 May 2017 13:42:13 +0000 (19:12 +0530)
tests/phpunit/api/v3/CustomFieldTest.php

index bf3792732ff488d529bb39578b473ca72bc1218a..bb8b70fed8e6bf1216b70efab06602adecaa8e00 100644 (file)
@@ -246,6 +246,28 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase {
     $this->assertEquals(0, $optionValueCount);
   }
 
+  /**
+   * Check with non-ascii labels
+   */
+  public function testCustomFieldCreateWithNonAsciiLabel() {
+    $customGroup = $this->customGroupCreate(array('extends' => 'Contact', 'title' => 'select_test_group'));
+    $params = array(
+      'custom_group_id' => $customGroup['id'],
+      'label' => 'ôôôô',
+      'html_type' => 'Select',
+      'data_type' => 'String',
+      'weight' => 4,
+      'is_required' => 1,
+      'is_searchable' => 0,
+      'is_active' => 1,
+    );
+    $customField = $this->callAPISuccess('custom_field', 'create', $params);
+    $this->assertNotNull($customField['id']);
+    $params['label'] = 'ààà';
+    $customField = $this->callAPISuccess('custom_field', 'create', $params);
+    $this->assertNotNull($customField['id']);
+  }
+
   /**
    * Test custom field with existing option group.
    */