summaryrefslogtreecommitdiffstats
path: root/tests/lib/files
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-04-22 11:10:51 +0200
committerVincent Petry <pvince81@owncloud.com>2016-04-22 14:02:55 +0200
commit27d12f7a993f335812cf29f19a12e2f86f553afc (patch)
tree18669ddb9ca411dd16367100874664877244a49c /tests/lib/files
parent27d6852b3ead63454d3cf0f3c79372af6852f9ac (diff)
downloadnextcloud-server-27d12f7a993f335812cf29f19a12e2f86f553afc.tar.gz
nextcloud-server-27d12f7a993f335812cf29f19a12e2f86f553afc.zip
Throw NoUserException when attempting to init mount point for null user
In some scenarios initMountPoints is called with an empty user, and also there is no user in the session. In such cases, it is unsafe to let the code move on with an empty user.
Diffstat (limited to 'tests/lib/files')
-rw-r--r--tests/lib/files/filesystem.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php
index db1f22f894a..8245af0ace1 100644
--- a/tests/lib/files/filesystem.php
+++ b/tests/lib/files/filesystem.php
@@ -320,6 +320,28 @@ class Filesystem extends \Test\TestCase {
}
/**
+ * @expectedException \OC\User\NoUserException
+ */
+ public function testNullUserThrows() {
+ \OC\Files\Filesystem::initMountPoints(null);
+ }
+
+ public function testNullUserThrowsTwice() {
+ $thrown = 0;
+ try {
+ \OC\Files\Filesystem::initMountPoints(null);
+ } catch (NoUserException $e) {
+ $thrown++;
+ }
+ try {
+ \OC\Files\Filesystem::initMountPoints(null);
+ } catch (NoUserException $e) {
+ $thrown++;
+ }
+ $this->assertEquals(2, $thrown);
+ }
+
+ /**
* Tests that the home storage is used for the user's mount point
*/
public function testHomeMount() {