Add test for having utf8 filenames in the cache
This commit is contained in:
parent
050f87c9e4
commit
30e0b474f8
|
@ -15,7 +15,7 @@ class TemporaryNoTouch extends \OC\Files\Storage\Temporary {
|
||||||
|
|
||||||
class View extends \PHPUnit_Framework_TestCase {
|
class View extends \PHPUnit_Framework_TestCase {
|
||||||
/**
|
/**
|
||||||
* @var \OC\Files\Storage\Storage[] $storages;
|
* @var \OC\Files\Storage\Storage[] $storages ;
|
||||||
*/
|
*/
|
||||||
private $storages = array();
|
private $storages = array();
|
||||||
|
|
||||||
|
@ -473,4 +473,34 @@ class View extends \PHPUnit_Framework_TestCase {
|
||||||
array('', '/'),
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue