added testcase to verify utf-8 string
authorsunil <esunil.pawar@gmail.com>
Thu, 30 Jun 2016 11:45:50 +0000 (17:15 +0530)
committersunil <esunil.pawar@gmail.com>
Thu, 30 Jun 2016 11:45:50 +0000 (17:15 +0530)
tests/phpunit/CRM/Utils/StringTest.php

index bd71876df004a873cc51c9f626a079043dabc71b..93e6ab69c36ab747daec1e1d5ae1c003e987d331 100644 (file)
@@ -86,6 +86,10 @@ class CRM_Utils_StringTest extends CiviUnitTestCase {
     foreach ($cases as $input => $expected) {
       $this->assertEquals($expected, CRM_Utils_String::ellipsify($input, $maxLen));
     }
+    // test utf-8 string, CRM-18997
+    $input = 'Registro de eventos on-line: Taller: "Onboarding - Cómo integrar exitosamente a los nuevos talentos dentro de su organización - Formación práctica."';
+    $maxLen = 128;
+    $this->assertEquals(true, mb_check_encoding(CRM_Utils_String::ellipsify($input, $maxLen), 'UTF-8'));
   }
 
   public function testRandom() {