[Pkg-owncloud-commits] [owncloud] 14/32: Add test for having utf8 filenames in the cache

David Prévot taffit at moszumanska.debian.org
Sun Dec 15 01:47:32 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit ca161e2a96a51407881692293122427b80686476
Author: Robin Appelman <icewind at owncloud.com>
Date:   Thu Dec 12 13:43:55 2013 +0100

    Add test for having utf8 filenames in the cache
---
 tests/lib/files/view.php | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index f358c15..a73a3f9 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);
+		}
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list