diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-11-26 16:21:40 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-11-26 17:27:16 +0000 |
commit | c853206e8a8d9f1f02180fcdd1a948e352cbd1b2 (patch) | |
tree | 6afd0b4385bdda8c6e44c941f5236e0861c8c8a0 /tests | |
parent | df961fa2f3e12e8115ecc755f0af6c384bae421b (diff) | |
download | nextcloud-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.php | 7 |
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)); + } } |