diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-06-05 10:05:05 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-06-05 10:05:05 +0200 |
commit | ff3ded6cb2f8542c3b2a083f4dabc83ccfa1888e (patch) | |
tree | bc041a07259ea4ba303503ac2ede3a4435f672b5 /tests | |
parent | cb61d8a2265b3d623b676f0cd35f93921961f044 (diff) | |
parent | da3974bcb210a6580c974e1b2efebcae26ccf708 (diff) | |
download | nextcloud-server-ff3ded6cb2f8542c3b2a083f4dabc83ccfa1888e.tar.gz nextcloud-server-ff3ded6cb2f8542c3b2a083f4dabc83ccfa1888e.zip |
Merge pull request #8852 from owncloud/kill-permissions-master
Kill permissions table
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/cache/permissions.php | 75 | ||||
-rw-r--r-- | tests/lib/files/cache/scanner.php | 2 | ||||
-rw-r--r-- | tests/lib/files/cache/updater.php | 31 | ||||
-rw-r--r-- | tests/lib/files/cache/watcher.php | 2 | ||||
-rw-r--r-- | tests/lib/files/node/folder.php | 8 | ||||
-rw-r--r-- | tests/lib/files/view.php | 2 |
6 files changed, 0 insertions, 120 deletions
diff --git a/tests/lib/files/cache/permissions.php b/tests/lib/files/cache/permissions.php deleted file mode 100644 index 4b284c2c8e2..00000000000 --- a/tests/lib/files/cache/permissions.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace Test\Files\Cache; - -use OC\Files\Storage\Temporary; - -class Permissions extends \PHPUnit_Framework_TestCase { - /*** - * @var \OC\Files\Cache\Permissions $permissionsCache - */ - private $permissionsCache; - - function setUp() { - $this->permissionsCache = new \OC\Files\Cache\Permissions('dummy'); - } - - function testSimple() { - $ids = range(1, 10); - $user = uniqid(); - - $this->assertEquals(-1, $this->permissionsCache->get(1, $user)); - $this->assertNotContains($user, $this->permissionsCache->getUsers(1)); - $this->permissionsCache->set(1, $user, 1); - $this->assertEquals(1, $this->permissionsCache->get(1, $user)); - $this->assertContains($user, $this->permissionsCache->getUsers(1)); - $this->assertEquals(-1, $this->permissionsCache->get(2, $user)); - $this->assertEquals(-1, $this->permissionsCache->get(1, $user . '2')); - - $this->permissionsCache->set(1, $user, 2); - $this->assertEquals(2, $this->permissionsCache->get(1, $user)); - - $this->permissionsCache->set(2, $user, 1); - $this->assertEquals(1, $this->permissionsCache->get(2, $user)); - - $this->permissionsCache->remove(1, $user); - $this->assertEquals(-1, $this->permissionsCache->get(1, $user)); - $this->permissionsCache->remove(1, $user . '2'); - $this->assertEquals(1, $this->permissionsCache->get(2, $user)); - - $expected = array(); - foreach ($ids as $id) { - $this->permissionsCache->set($id, $user, 10 + $id); - $expected[$id] = 10 + $id; - } - $this->assertEquals($expected, $this->permissionsCache->getMultiple($ids, $user)); - - $this->permissionsCache->removeMultiple(array(10, 9), $user); - unset($expected[9]); - unset($expected[10]); - $this->assertEquals($expected, $this->permissionsCache->getMultiple($ids, $user)); - - $this->permissionsCache->removeMultiple($ids, $user); - } - - public function testUpdatePermissionsOnRescan() { - $storage = new Temporary(array()); - $scanner = $storage->getScanner(); - $cache = $storage->getCache(); - $permissionsCache = $storage->getPermissionsCache(); - - $storage->file_put_contents('foo.txt', 'bar'); - $scanner->scan(''); - $id = $cache->getId('foo.txt'); - $permissionsCache->set($id, 'test', 1); - - $scanner->scan(''); - $this->assertEquals(-1, $permissionsCache->get($id, 'test')); - } -} diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php index 56c7b65bb08..263e5b3445f 100644 --- a/tests/lib/files/cache/scanner.php +++ b/tests/lib/files/cache/scanner.php @@ -33,8 +33,6 @@ class Scanner extends \PHPUnit_Framework_TestCase { function tearDown() { if ($this->cache) { $ids = $this->cache->getAll(); - $permissionsCache = $this->storage->getPermissionsCache(); - $permissionsCache->removeMultiple($ids, \OC_User::getUser()); $this->cache->clear(); } } diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php index e2fae0ae57f..b874e418100 100644 --- a/tests/lib/files/cache/updater.php +++ b/tests/lib/files/cache/updater.php @@ -328,35 +328,4 @@ class Updater extends \PHPUnit_Framework_TestCase { $this->assertEquals($time, $cachedData['mtime']); } - public function testUpdatePermissionsOnRescanOnlyForUpdatedFile() { - $permissionsCache = $this->storage->getPermissionsCache(); - $scanner = $this->storage->getScanner(); - $scanner->scan(''); - $cache = $this->storage->getCache(); - $loggedInUser = \OC_User::getUser(); - \OC_User::setUserId(self::$user); - FileSystem::getDirectoryContent('/'); - $past = time() - 600; - $cache->put('', array('storage_mtime' => $past)); - - $this->assertNotEquals(-1, $permissionsCache->get($cache->getId('foo.txt'), self::$user)); - $this->assertNotEquals(-1, $permissionsCache->get($cache->getId('foo.png'), self::$user)); - - $permissionsCache->set($cache->getId('foo.png'), self::$user, 15); - FileSystem::file_put_contents('/foo.txt', 'asd'); - - $this->assertEquals(-1, $permissionsCache->get($cache->getId('foo.txt'), self::$user)); - $this->assertEquals(15, $permissionsCache->get($cache->getId('foo.png'), self::$user)); - - FileSystem::getDirectoryContent('/'); - - $this->assertEquals(15, $permissionsCache->get($cache->getId('foo.png'), self::$user)); - - FileSystem::file_put_contents('/qwerty.txt', 'asd'); - FileSystem::getDirectoryContent('/'); - - $this->assertEquals(15, $permissionsCache->get($cache->getId('foo.png'), self::$user)); - - \OC_User::setUserId($loggedInUser); - } } diff --git a/tests/lib/files/cache/watcher.php b/tests/lib/files/cache/watcher.php index 7f4f3c5ee98..22c11b9a4e0 100644 --- a/tests/lib/files/cache/watcher.php +++ b/tests/lib/files/cache/watcher.php @@ -23,8 +23,6 @@ class Watcher extends \PHPUnit_Framework_TestCase { foreach ($this->storages as $storage) { $cache = $storage->getCache(); $ids = $cache->getAll(); - $permissionsCache = $storage->getPermissionsCache(); - $permissionsCache->removeMultiple($ids, \OC_User::getUser()); $cache->clear(); } } diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php index b1589a276ba..08200f35f57 100644 --- a/tests/lib/files/node/folder.php +++ b/tests/lib/files/node/folder.php @@ -155,20 +155,12 @@ class Folder extends \PHPUnit_Framework_TestCase { array('fileid' => 3, 'path' => '/bar/foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'httpd/unix-directory') ))); - $permissionsCache = $this->getMock('\OC\Files\Cache\Permissions', array(), array('/')); - $permissionsCache->expects($this->once()) - ->method('getDirectoryPermissions') - ->will($this->returnValue(array(2 => \OCP\PERMISSION_ALL))); - $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') ->will($this->returnValue(array())); $storage->expects($this->any()) - ->method('getPermissionsCache') - ->will($this->returnValue($permissionsCache)); - $storage->expects($this->any()) ->method('getCache') ->will($this->returnValue($cache)); diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 1d8e729fb7b..b2e0b59d8e6 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -39,8 +39,6 @@ class View extends \PHPUnit_Framework_TestCase { foreach ($this->storages as $storage) { $cache = $storage->getCache(); $ids = $cache->getAll(); - $permissionsCache = $storage->getPermissionsCache(); - $permissionsCache->removeMultiple($ids, \OC_User::getUser()); $cache->clear(); } } |