diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-12-12 13:43:55 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-12-12 13:43:55 +0100 |
commit | 30e0b474f89183bea4a64c81441300d3db8999c5 (patch) | |
tree | f1929df7f7a903a819ac08796dfbe998c3ed2799 /tests/lib | |
parent | 050f87c9e42061b7994ae1c32918a691141f63be (diff) | |
download | nextcloud-server-30e0b474f89183bea4a64c81441300d3db8999c5.tar.gz nextcloud-server-30e0b474f89183bea4a64c81441300d3db8999c5.zip |
Add test for having utf8 filenames in the cache
Diffstat (limited to 'tests/lib')
-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..a73a3f9d252 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); + } + } } |