diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-11-26 16:21:40 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-11-26 16:21:40 +0100 |
commit | d384edc9c6bbf708e621c50315c81f02400ff9a6 (patch) | |
tree | c90e1e587d926a091555726bdab1e5e776ee7d2e /tests | |
parent | aee3bb42aeb716ff6c60401cd60ec7d6d7a36bec (diff) | |
download | nextcloud-server-d384edc9c6bbf708e621c50315c81f02400ff9a6.tar.gz nextcloud-server-d384edc9c6bbf708e621c50315c81f02400ff9a6.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)); + } } |