Merge pull request #11735 from mukeshcompucorp/CRM-21814-add-proper-container-to...
[civicrm-core.git] / tests / phpunit / api / v3 / CustomFieldTest.php
index 0247ba34a739c23a83d17d094043d6bf752ad897..51c49c8409687be60ce3c9da95154eb500cb1fa4 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
 | CiviCRM version 4.7                                                |
 +--------------------------------------------------------------------+
-| Copyright CiviCRM LLC (c) 2004-2016                                |
+| Copyright CiviCRM LLC (c) 2004-2018                                |
 +--------------------------------------------------------------------+
 | This file is a part of CiviCRM.                                    |
 |                                                                    |
@@ -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.
    */