summaryrefslogtreecommitdiffstats
path: root/tests/lib/util.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-11-06 11:57:04 +0100
committerVincent Petry <pvince81@owncloud.com>2013-11-21 12:04:54 +0100
commit356eef07398f8829a2558eee809599be60441b59 (patch)
tree29ff768c8b73af5f73d75610dedbf4c6231bb28a /tests/lib/util.php
parent391f267d380f0d098d730d3bc74633192cc13570 (diff)
downloadnextcloud-server-356eef07398f8829a2558eee809599be60441b59.tar.gz
nextcloud-server-356eef07398f8829a2558eee809599be60441b59.zip
Quota storage wrapper is now used for all users in sharing mode
When accessing a shared folder, the folder's owner appears as mountpoint but wasn't wrapped by a quota storage wrapper. This fix makes sure that all home storages are wrapped by a quota storage wrapper, if applicable, to make sure quotas are respected when uploading into shared folders.
Diffstat (limited to 'tests/lib/util.php')
-rw-r--r--tests/lib/util.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/lib/util.php b/tests/lib/util.php
index d607a3e7725..852caaeccc3 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -94,6 +94,55 @@ class Test_Util extends PHPUnit_Framework_TestCase {
}
/**
+ * Tests that the home storage is not wrapped when no quota exists.
+ */
+ function testHomeStorageWrapperWithoutQuota() {
+ $user1 = uniqid();
+ \OC_User::createUser($user1, 'test');
+ OC_Preferences::setValue($user1, 'files', 'quota', 'none');
+ \OC_User::setUserId($user1);
+
+ \OC_Util::setupFS($user1);
+
+ $userMount = \OC\Files\Filesystem::getMountManager()->find('/' . $user1 . '/');
+ $this->assertNotNull($userMount);
+ $this->assertNotInstanceOf('\OC\Files\Storage\Wrapper\Quota', $userMount->getStorage());
+
+ // clean up
+ \OC_User::setUserId('');
+ \OC_User::deleteUser($user1);
+ OC_Preferences::deleteUser($user1);
+ \OC_Util::tearDownFS();
+ }
+
+ /**
+ * Tests that the home storage is not wrapped when no quota exists.
+ */
+ function testHomeStorageWrapperWithQuota() {
+ $user1 = uniqid();
+ \OC_User::createUser($user1, 'test');
+ OC_Preferences::setValue($user1, 'files', 'quota', '1024');
+ \OC_User::setUserId($user1);
+
+ \OC_Util::setupFS($user1);
+
+ $userMount = \OC\Files\Filesystem::getMountManager()->find('/' . $user1 . '/');
+ $this->assertNotNull($userMount);
+ $this->assertInstanceOf('\OC\Files\Storage\Wrapper\Quota', $userMount->getStorage());
+
+ // ensure that root wasn't wrapped
+ $rootMount = \OC\Files\Filesystem::getMountManager()->find('/');
+ $this->assertNotNull($rootMount);
+ $this->assertNotInstanceOf('\OC\Files\Storage\Wrapper\Quota', $rootMount->getStorage());
+
+ // clean up
+ \OC_User::setUserId('');
+ \OC_User::deleteUser($user1);
+ OC_Preferences::deleteUser($user1);
+ \OC_Util::tearDownFS();
+ }
+
+ /**
* @dataProvider baseNameProvider
*/
public function testBaseName($expected, $file)