aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2021-11-26 16:21:40 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-11-26 17:27:16 +0000
commitc853206e8a8d9f1f02180fcdd1a948e352cbd1b2 (patch)
tree6afd0b4385bdda8c6e44c941f5236e0861c8c8a0 /tests
parentdf961fa2f3e12e8115ecc755f0af6c384bae421b (diff)
downloadnextcloud-server-c853206e8a8d9f1f02180fcdd1a948e352cbd1b2.tar.gz
nextcloud-server-c853206e8a8d9f1f02180fcdd1a948e352cbd1b2.zip
add method to shorten a string to given byte size to Utils
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/UtilTest.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index bb328c5998d..ca7a4ad1442 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -310,4 +310,11 @@ class UtilTest extends \Test\TestCase {
'myApp/vendor/myFancyCSSFile2',
], \OC_Util::$styles);
}
+
+ public function testShortenMultibyteString() {
+ $this->assertEquals('Short nuff', \OCP\Util::shortenMultibyteString('Short nuff', 255));
+ $this->assertEquals('ABC', \OCP\Util::shortenMultibyteString('ABCDEF', 3));
+ // each of the characters is 12 bytes
+ $this->assertEquals('🙈', \OCP\Util::shortenMultibyteString('🙈🙊🙉', 16, 2));
+ }
}