test upper
authordemeritcowboy <demeritcowboy@hotmail.com>
Sun, 18 Jul 2021 02:32:37 +0000 (22:32 -0400)
committerdemeritcowboy <demeritcowboy@hotmail.com>
Sun, 18 Jul 2021 02:32:37 +0000 (22:32 -0400)
tests/phpunit/CRM/Core/Smarty/plugins/CrmUpperTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/CRM/Core/Smarty/plugins/CrmUpperTest.php b/tests/phpunit/CRM/Core/Smarty/plugins/CrmUpperTest.php
new file mode 100644 (file)
index 0000000..4d32e40
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * Class CRM_Core_Smarty_plugins_CrmUpperTest
+ * @group headless
+ */
+class CRM_Core_Smarty_plugins_CrmUpperTest extends CiviUnitTestCase {
+
+  public function setUp(): void {
+    parent::setUp();
+    require_once 'CRM/Core/Smarty.php';
+
+    // Templates should normally be file names, but for unit-testing it's handy to use "string:" notation
+    require_once 'CRM/Core/Smarty/resources/String.php';
+    civicrm_smarty_register_string_resource();
+  }
+
+  /**
+   * Test accents with upper
+   */
+  public function testUpper() {
+    $smarty = CRM_Core_Smarty::singleton();
+    $actual = $smarty->fetch('string:{assign var="nom" value="Pièrre"}{$nom|crmUpper}');
+    $this->assertEquals('PIÈRRE', $actual);
+  }
+
+}