diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/files/view.php | 32 | ||||
-rw-r--r-- | tests/lib/user/session.php | 15 |
2 files changed, 44 insertions, 3 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); + } + } } diff --git a/tests/lib/user/session.php b/tests/lib/user/session.php index e457a7bda30..46b268b3624 100644 --- a/tests/lib/user/session.php +++ b/tests/lib/user/session.php @@ -52,9 +52,20 @@ class Session extends \PHPUnit_Framework_TestCase { public function testLoginValidPasswordEnabled() { $session = $this->getMock('\OC\Session\Memory', array(), array('')); - $session->expects($this->once()) + $session->expects($this->exactly(2)) ->method('set') - ->with('user_id', 'foo'); + ->with($this->callback(function($key) { + switch($key) { + case 'user_id': + case 'loginname': + return true; + break; + default: + return false; + break; + } + }, + 'foo')); $manager = $this->getMock('\OC\User\Manager'); |