diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-12-13 01:27:13 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-12-13 01:27:13 -0800 |
commit | 600655b0f974e90842116ec03016819b0e122b41 (patch) | |
tree | 3bd2eb03806ddb594ac5f1fe926b5310b941336d | |
parent | 9842890ed7ec446b9c7a6a7dfb389dbbc944e38f (diff) | |
parent | 46b72cbff098babcf9dc63304ebd9a97df3c2d5c (diff) | |
download | nextcloud-server-600655b0f974e90842116ec03016819b0e122b41.tar.gz nextcloud-server-600655b0f974e90842116ec03016819b0e122b41.zip |
Merge pull request #6347 from owncloud/cache-test-utf8
Add test for having utf8 filenames in the cache
-rw-r--r-- | tests/lib/files/view.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index f358c15dd50..b59cef9f0da 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -15,7 +15,7 @@ class TemporaryNoTouch extends \OC\Files\Storage\Temporary { class View extends \PHPUnit_Framework_TestCase { /** - * @var \OC\Files\Storage\Storage[] $storages; + * @var \OC\Files\Storage\Storage[] $storages */ private $storages = array(); @@ -473,4 +473,34 @@ class View extends \PHPUnit_Framework_TestCase { array('', '/'), ); } + + public function testUTF8Names() { + $names = array('虚', '和知しゃ和で', 'regular ascii', 'sɨˈrɪlɪk', 'ѨѬ', 'أنا أحب القراءة كثيرا'); + + $storage = new \OC\Files\Storage\Temporary(array()); + \OC\Files\Filesystem::mount($storage, array(), '/'); + + $rootView = new \OC\Files\View(''); + foreach ($names as $name) { + $rootView->file_put_contents('/' . $name, 'dummy content'); + } + + $list = $rootView->getDirectoryContent('/'); + + $this->assertCount(count($names), $list); + foreach ($list as $item) { + $this->assertContains($item['name'], $names); + } + + $cache = $storage->getCache(); + $scanner = $storage->getScanner(); + $scanner->scan(''); + + $list = $cache->getFolderContents(''); + + $this->assertCount(count($names), $list); + foreach ($list as $item) { + $this->assertContains($item['name'], $names); + } + } } |