aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/FilesystemTest.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-01 12:20:38 +0200
committerVincent Petry <pvince81@owncloud.com>2016-06-01 14:28:59 +0200
commit5ad8fa76756801eee2aac18459aed60d03b4d4bc (patch)
treee5582d056b8ad473333292c2da6777dbf9868c19 /tests/lib/Files/FilesystemTest.php
parent7b4459d28d40523c70ec05a733e158f2c14faac4 (diff)
downloadnextcloud-server-5ad8fa76756801eee2aac18459aed60d03b4d4bc.tar.gz
nextcloud-server-5ad8fa76756801eee2aac18459aed60d03b4d4bc.zip
Add keepUnicode value in the cache key of normalizedPathCache
Diffstat (limited to 'tests/lib/Files/FilesystemTest.php')
-rw-r--r--tests/lib/Files/FilesystemTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php
index a4a4345d2f9..76e3f471633 100644
--- a/tests/lib/Files/FilesystemTest.php
+++ b/tests/lib/Files/FilesystemTest.php
@@ -92,6 +92,7 @@ class FilesystemTest extends \Test\TestCase {
}
$this->logout();
+ $this->invokePrivate('\OC\Files\Filesystem', 'normalizedPathCache', [null]);
parent::tearDown();
}
@@ -190,6 +191,32 @@ class FilesystemTest extends \Test\TestCase {
$this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash));
}
+ public function normalizePathKeepUnicodeData() {
+ $nfdName = 'ümlaut';
+ $nfcName = 'ümlaut';
+ return [
+ ['/' . $nfcName, $nfcName, true],
+ ['/' . $nfcName, $nfcName, false],
+ ['/' . $nfdName, $nfdName, true],
+ ['/' . $nfcName, $nfdName, false],
+ ];
+ }
+
+ /**
+ * @dataProvider normalizePathKeepUnicodeData
+ */
+ public function testNormalizePathKeepUnicode($expected, $path, $keepUnicode = false) {
+ $this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, true, false, $keepUnicode));
+ }
+
+ public function testNormalizePathKeepUnicodeCache() {
+ $nfdName = 'ümlaut';
+ $nfcName = 'ümlaut';
+ // call in succession due to cache
+ $this->assertEquals('/' . $nfcName, \OC\Files\Filesystem::normalizePath($nfdName, true, false, false));
+ $this->assertEquals('/' . $nfdName, \OC\Files\Filesystem::normalizePath($nfdName, true, false, true));
+ }
+
public function isValidPathData() {
return array(
array('/', true),