summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/tests/unit/connector/sabre/file.php44
-rw-r--r--apps/files/tests/controller/apicontrollertest.php9
-rw-r--r--apps/files_external/lib/personalmount.php8
-rw-r--r--apps/files_external/tests/personalmounttest.php50
-rw-r--r--apps/files_sharing/lib/external/storage.php8
-rw-r--r--apps/files_sharing/lib/sharedstorage.php2
-rw-r--r--apps/user_ldap/js/wizard/wizardTabGeneric.js6
-rw-r--r--core/command/maintenance/install.php7
-rw-r--r--lib/private/appframework/app.php2
-rw-r--r--lib/private/console/application.php11
-rw-r--r--lib/private/files/fileinfo.php8
-rw-r--r--lib/private/files/storage/common.php4
-rw-r--r--lib/private/files/view.php2
-rw-r--r--lib/private/preview.php8
-rw-r--r--lib/private/share/share.php7
-rw-r--r--tests/lib/files/node/file.php10
-rw-r--r--tests/lib/files/node/folder.php10
-rw-r--r--tests/lib/files/node/node.php10
18 files changed, 165 insertions, 41 deletions
diff --git a/apps/dav/tests/unit/connector/sabre/file.php b/apps/dav/tests/unit/connector/sabre/file.php
index 2a6cf46ef16..ad4c1d29ed4 100644
--- a/apps/dav/tests/unit/connector/sabre/file.php
+++ b/apps/dav/tests/unit/connector/sabre/file.php
@@ -48,6 +48,14 @@ class File extends \Test\TestCase {
parent::tearDown();
}
+ private function getMockStorage() {
+ $storage = $this->getMock('\OCP\Files\Storage');
+ $storage->expects($this->any())
+ ->method('getId')
+ ->will($this->returnValue('home::someuser'));
+ return $storage;
+ }
+
/**
* @param string $string
*/
@@ -149,7 +157,7 @@ class File extends \Test\TestCase {
->method('getRelativePath')
->will($this->returnArgument(0));
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -209,7 +217,7 @@ class File extends \Test\TestCase {
$_SERVER['HTTP_OC_CHUNKED'] = true;
- $info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-0', null, null, [
+ $info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-0', $this->getMockStorage(), null, [
'permissions' => \OCP\Constants::PERMISSION_ALL
], null);
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
@@ -219,7 +227,7 @@ class File extends \Test\TestCase {
$this->assertNull($file->put('test data one'));
$file->releaseLock(ILockingProvider::LOCK_SHARED);
- $info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-1', null, null, [
+ $info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-1', $this->getMockStorage(), null, [
'permissions' => \OCP\Constants::PERMISSION_ALL
], null);
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
@@ -261,7 +269,7 @@ class File extends \Test\TestCase {
$info = new \OC\Files\FileInfo(
$viewRoot . '/' . ltrim($path, '/'),
- null,
+ $this->getMockStorage(),
null,
['permissions' => \OCP\Constants::PERMISSION_ALL],
null
@@ -450,7 +458,7 @@ class File extends \Test\TestCase {
$_SERVER['CONTENT_LENGTH'] = 123456;
$_SERVER['REQUEST_METHOD'] = 'PUT';
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -483,7 +491,7 @@ class File extends \Test\TestCase {
// simulate situation where the target file is locked
$view->lockFile('/test.txt', ILockingProvider::LOCK_EXCLUSIVE);
- $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -518,7 +526,7 @@ class File extends \Test\TestCase {
$_SERVER['HTTP_OC_CHUNKED'] = true;
- $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-0', null, null, [
+ $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-0', $this->getMockStorage(), null, [
'permissions' => \OCP\Constants::PERMISSION_ALL
], null);
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
@@ -526,7 +534,7 @@ class File extends \Test\TestCase {
$this->assertNull($file->put('test data one'));
$file->releaseLock(ILockingProvider::LOCK_SHARED);
- $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-1', null, null, [
+ $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-1', $this->getMockStorage(), null, [
'permissions' => \OCP\Constants::PERMISSION_ALL
], null);
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
@@ -555,7 +563,7 @@ class File extends \Test\TestCase {
->method('getRelativePath')
->will($this->returnArgument(0));
- $info = new \OC\Files\FileInfo('/*', null, null, array(
+ $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
@@ -591,7 +599,7 @@ class File extends \Test\TestCase {
->method('getRelativePath')
->will($this->returnArgument(0));
- $info = new \OC\Files\FileInfo('/*', null, null, array(
+ $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
@@ -618,7 +626,7 @@ class File extends \Test\TestCase {
$_SERVER['CONTENT_LENGTH'] = 12345;
$_SERVER['REQUEST_METHOD'] = 'PUT';
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -654,7 +662,7 @@ class File extends \Test\TestCase {
->method('unlink')
->will($this->returnValue(true));
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -672,7 +680,7 @@ class File extends \Test\TestCase {
$view = $this->getMock('\OC\Files\View',
array());
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => 0
), null);
@@ -695,7 +703,7 @@ class File extends \Test\TestCase {
->method('unlink')
->will($this->returnValue(false));
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -718,7 +726,7 @@ class File extends \Test\TestCase {
->method('unlink')
->willThrowException(new ForbiddenException('', true));
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -753,7 +761,7 @@ class File extends \Test\TestCase {
$path = 'test-locking.txt';
$info = new \OC\Files\FileInfo(
'/' . $this->user . '/files/' . $path,
- null,
+ $this->getMockStorage(),
null,
['permissions' => \OCP\Constants::PERMISSION_ALL],
null
@@ -865,7 +873,7 @@ class File extends \Test\TestCase {
->method('fopen')
->will($this->returnValue(false));
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
@@ -883,7 +891,7 @@ class File extends \Test\TestCase {
->method('fopen')
->willThrowException(new ForbiddenException('', true));
- $info = new \OC\Files\FileInfo('/test.txt', null, null, array(
+ $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
diff --git a/apps/files/tests/controller/apicontrollertest.php b/apps/files/tests/controller/apicontrollertest.php
index fb728d5eff0..bc66e4641b9 100644
--- a/apps/files/tests/controller/apicontrollertest.php
+++ b/apps/files/tests/controller/apicontrollertest.php
@@ -92,6 +92,7 @@ class ApiControllerTest extends TestCase {
[
'mtime' => 55,
'mimetype' => 'application/pdf',
+ 'permissions' => 31,
'size' => 1234,
'etag' => 'MyEtag',
],
@@ -111,7 +112,7 @@ class ApiControllerTest extends TestCase {
'parentId' => null,
'mtime' => 55000,
'name' => 'root.txt',
- 'permissions' => null,
+ 'permissions' => 31,
'mimetype' => 'application/pdf',
'size' => 1234,
'type' => 'file',
@@ -139,6 +140,7 @@ class ApiControllerTest extends TestCase {
[
'mtime' => 55,
'mimetype' => 'application/pdf',
+ 'permissions' => 31,
'size' => 1234,
'etag' => 'MyEtag',
],
@@ -155,6 +157,7 @@ class ApiControllerTest extends TestCase {
[
'mtime' => 999,
'mimetype' => 'application/binary',
+ 'permissions' => 31,
'size' => 9876,
'etag' => 'SubEtag',
],
@@ -174,7 +177,7 @@ class ApiControllerTest extends TestCase {
'parentId' => null,
'mtime' => 55000,
'name' => 'root.txt',
- 'permissions' => null,
+ 'permissions' => 31,
'mimetype' => 'application/pdf',
'size' => 1234,
'type' => 'file',
@@ -191,7 +194,7 @@ class ApiControllerTest extends TestCase {
'parentId' => null,
'mtime' => 999000,
'name' => 'root.txt',
- 'permissions' => null,
+ 'permissions' => 31,
'mimetype' => 'application/binary',
'size' => 9876,
'type' => 'file',
diff --git a/apps/files_external/lib/personalmount.php b/apps/files_external/lib/personalmount.php
index 26f68ba32db..f81dee5be1e 100644
--- a/apps/files_external/lib/personalmount.php
+++ b/apps/files_external/lib/personalmount.php
@@ -35,7 +35,7 @@ class PersonalMount extends MountPoint implements MoveableMount {
protected $storagesService;
/** @var int */
- protected $storageId;
+ protected $numericStorageId;
/**
* @param UserStoragesService $storagesService
@@ -57,7 +57,7 @@ class PersonalMount extends MountPoint implements MoveableMount {
) {
parent::__construct($storage, $mountpoint, $arguments, $loader, $mountOptions);
$this->storagesService = $storagesService;
- $this->storageId = $storageId;
+ $this->numericStorageId = $storageId;
}
/**
@@ -67,7 +67,7 @@ class PersonalMount extends MountPoint implements MoveableMount {
* @return bool
*/
public function moveMount($target) {
- $storage = $this->storagesService->getStorage($this->storageId);
+ $storage = $this->storagesService->getStorage($this->numericStorageId);
// remove "/$user/files" prefix
$targetParts = explode('/', trim($target, '/'), 3);
$storage->setMountPoint($targetParts[2]);
@@ -82,7 +82,7 @@ class PersonalMount extends MountPoint implements MoveableMount {
* @return bool
*/
public function removeMount() {
- $this->storagesService->removeStorage($this->storageId);
+ $this->storagesService->removeStorage($this->numericStorageId);
return true;
}
}
diff --git a/apps/files_external/tests/personalmounttest.php b/apps/files_external/tests/personalmounttest.php
new file mode 100644
index 00000000000..b56d69aa9be
--- /dev/null
+++ b/apps/files_external/tests/personalmounttest.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * @author Robin Appelman <icewind@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Files_external\Tests;
+
+use OC\Files\Mount\Manager;
+use OCA\Files_External\Lib\PersonalMount;
+use Test\TestCase;
+
+class PersonalMountTest extends TestCase {
+ public function testFindByStorageId() {
+ /** @var \OCA\Files_External\Service\UserStoragesService $storageService */
+ $storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $storage->expects($this->any())
+ ->method('getId')
+ ->will($this->returnValue('dummy'));
+
+ $mount = new PersonalMount($storageService, 10, $storage, '/foo');
+
+ $mountManager = new Manager();
+ $mountManager->addMount($mount);
+
+ $this->assertEquals([$mount], $mountManager->findByStorageId('dummy'));
+ }
+}
diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index 2a0d827e064..36ff4f0c226 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -265,4 +265,12 @@ class Storage extends DAV implements ISharedStorage {
list(, $remote) = explode('://', $this->remote, 2);
return $this->remoteUser . '@' . $remote;
}
+
+ public function isSharable($path) {
+ if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
+ return false;
+ }
+ return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
+ }
+
}
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index cda3f564d5f..38f79762dc6 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -257,7 +257,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
}
public function isSharable($path) {
- if (\OCP\Util::isSharingDisabledForUser()) {
+ if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
return false;
}
return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
diff --git a/apps/user_ldap/js/wizard/wizardTabGeneric.js b/apps/user_ldap/js/wizard/wizardTabGeneric.js
index 60e7cd2ad9e..8940a8468a0 100644
--- a/apps/user_ldap/js/wizard/wizardTabGeneric.js
+++ b/apps/user_ldap/js/wizard/wizardTabGeneric.js
@@ -198,9 +198,13 @@ OCA = OCA || {};
return;
}
- // deal with text area
+ // special cases: deal with text area and multiselect
if ($element.is('textarea') && $.isArray(value)) {
value = value.join("\n");
+ } else if($element.hasClass(this.multiSelectPluginClass)) {
+ if(!_.isArray(value)) {
+ value = value.split("\n");
+ }
}
if ($element.is('span')) {
diff --git a/core/command/maintenance/install.php b/core/command/maintenance/install.php
index b0235c518ec..d4ef72c9fc8 100644
--- a/core/command/maintenance/install.php
+++ b/core/command/maintenance/install.php
@@ -68,7 +68,12 @@ class Install extends Command {
$errors = $sysInfo['errors'];
if (count($errors) > 0) {
$this->printErrors($output, $errors);
- return 1;
+
+ // ignore the OS X setup warning
+ if(count($errors) !== 1 ||
+ (string)($errors[0]['error']) !== 'Mac OS X is not supported and ownCloud will not work properly on this platform. Use it at your own risk! ') {
+ return 1;
+ }
}
// validate user input
diff --git a/lib/private/appframework/app.php b/lib/private/appframework/app.php
index 0188d221be1..5cad32bbd09 100644
--- a/lib/private/appframework/app.php
+++ b/lib/private/appframework/app.php
@@ -26,6 +26,7 @@
namespace OC\AppFramework;
+use OC\AppFramework\Http\Dispatcher;
use OC_App;
use OC\AppFramework\DependencyInjection\DIContainer;
use OCP\AppFramework\QueryException;
@@ -97,6 +98,7 @@ class App {
}
// initialize the dispatcher and run all the middleware before the controller
+ /** @var Dispatcher $dispatcher */
$dispatcher = $container['Dispatcher'];
list(
diff --git a/lib/private/console/application.php b/lib/private/console/application.php
index 55c817d497f..c46e6d60de2 100644
--- a/lib/private/console/application.php
+++ b/lib/private/console/application.php
@@ -48,16 +48,20 @@ class Application {
/**
* @param OutputInterface $output
+ * @throws \Exception
*/
public function loadCommands(OutputInterface $output) {
// $application is required to be defined in the register_command scripts
$application = $this->application;
- require_once \OC::$SERVERROOT . '/core/register_command.php';
+ require_once __DIR__ . '/../../../core/register_command.php';
if ($this->config->getSystemValue('installed', false)) {
if (!\OCP\Util::needUpgrade()) {
OC_App::loadApps();
foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
$appPath = \OC_App::getAppPath($app);
+ if($appPath === false) {
+ continue;
+ }
\OC::$loader->addValidRoot($appPath);
$file = $appPath . '/appinfo/register_command.php';
if (file_exists($file)) {
@@ -85,6 +89,11 @@ class Application {
}
}
+ /**
+ * Sets whether to automatically exit after a command execution or not.
+ *
+ * @param bool $boolean Whether to automatically exit after a command execution or not
+ */
public function setAutoExit($boolean) {
$this->application->setAutoExit($boolean);
}
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index 5b5e8697004..5ed65cd3795 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -100,6 +100,8 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return $this->getType();
} else if ($offset === 'etag') {
return $this->getEtag();
+ } elseif ($offset === 'permissions') {
+ return $this->getPermissions();
} elseif (isset($this->data[$offset])) {
return $this->data[$offset];
} else {
@@ -193,7 +195,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
* @return int
*/
public function getPermissions() {
- return $this->data['permissions'];
+ $perms = $this->data['permissions'];
+ if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
+ $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
+ }
+ return $perms;
}
/**
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 0cd67e343ff..b06543d0a6a 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -141,10 +141,6 @@ abstract class Common implements Storage {
}
public function isSharable($path) {
- if (\OCP\Util::isSharingDisabledForUser()) {
- return false;
- }
-
return $this->isReadable($path);
}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 6abefff4198..b8b1b8a50d6 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1253,7 +1253,7 @@ class View {
* @param boolean|string $includeMountPoints true to add mountpoint sizes,
* 'ext' to add only ext storage mount point sizes. Defaults to true.
* defaults to true
- * @return \OC\Files\FileInfo|bool False if file does not exist
+ * @return \OC\Files\FileInfo|false False if file does not exist
*/
public function getFileInfo($path, $includeMountPoints = true) {
$this->assertPathLength($path);
diff --git a/lib/private/preview.php b/lib/private/preview.php
index b2accdfd00f..38c043030fc 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -1250,7 +1250,7 @@ class Preview {
* @param array $args
* @param string $prefix
*/
- public static function prepare_delete($args, $prefix = '') {
+ public static function prepare_delete(array $args, $prefix = '') {
$path = $args['path'];
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
@@ -1259,7 +1259,11 @@ class Preview {
$view = new \OC\Files\View('/' . \OC_User::getUser() . '/' . $prefix);
$absPath = Files\Filesystem::normalizePath($view->getAbsolutePath($path));
- self::addPathToDeleteFileMapper($absPath, $view->getFileInfo($path));
+ $fileInfo = $view->getFileInfo($path);
+ if($fileInfo === false) {
+ return;
+ }
+ self::addPathToDeleteFileMapper($absPath, $fileInfo);
if ($view->is_dir($path)) {
$children = self::getAllChildren($view, $path);
self::$deleteChildrenMapper[$absPath] = $children;
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 8899df25636..3edffba8a3f 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -635,7 +635,7 @@ class Share extends Constants {
throw new \Exception($message_t);
}
// verify that the user has share permission
- if (!\OC\Files\Filesystem::isSharable($path)) {
+ if (!\OC\Files\Filesystem::isSharable($path) || \OCP\Util::isSharingDisabledForUser()) {
$message = 'You are not allowed to share %s';
$message_t = $l->t('You are not allowed to share %s', [$path]);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $path), \OCP\Util::DEBUG);
@@ -762,6 +762,11 @@ class Share extends Constants {
$updateExistingShare = false;
if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
+ // IF the password is changed via the old ajax endpoint verify it before deleting the old share
+ if ($passwordChanged === true) {
+ self::verifyPassword($shareWith);
+ }
+
// when updating a link share
// FIXME Don't delete link if we update it
if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_LINK, null,
diff --git a/tests/lib/files/node/file.php b/tests/lib/files/node/file.php
index d0072949c7f..ccc777c499f 100644
--- a/tests/lib/files/node/file.php
+++ b/tests/lib/files/node/file.php
@@ -21,8 +21,16 @@ class File extends \Test\TestCase {
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy);
}
+ protected function getMockStorage() {
+ $storage = $this->getMock('\OCP\Files\Storage');
+ $storage->expects($this->any())
+ ->method('getId')
+ ->will($this->returnValue('home::someuser'));
+ return $storage;
+ }
+
protected function getFileInfo($data) {
- return new FileInfo('', null, '', $data, null);
+ return new FileInfo('', $this->getMockStorage(), '', $data, null);
}
public function testDelete() {
diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php
index d95e1b5d2b2..09bf32561e6 100644
--- a/tests/lib/files/node/folder.php
+++ b/tests/lib/files/node/folder.php
@@ -31,8 +31,16 @@ class Folder extends \Test\TestCase {
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy);
}
+ protected function getMockStorage() {
+ $storage = $this->getMock('\OCP\Files\Storage');
+ $storage->expects($this->any())
+ ->method('getId')
+ ->will($this->returnValue('home::someuser'));
+ return $storage;
+ }
+
protected function getFileInfo($data) {
- return new FileInfo('', null, '', $data, null);
+ return new FileInfo('', $this->getMockStorage(), '', $data, null);
}
public function testDelete() {
diff --git a/tests/lib/files/node/node.php b/tests/lib/files/node/node.php
index afcf4cbabaa..a1693b034fa 100644
--- a/tests/lib/files/node/node.php
+++ b/tests/lib/files/node/node.php
@@ -18,8 +18,16 @@ class Node extends \Test\TestCase {
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy);
}
+ protected function getMockStorage() {
+ $storage = $this->getMock('\OCP\Files\Storage');
+ $storage->expects($this->any())
+ ->method('getId')
+ ->will($this->returnValue('home::someuser'));
+ return $storage;
+ }
+
protected function getFileInfo($data) {
- return new FileInfo('', null, '', $data, null);
+ return new FileInfo('', $this->getMockStorage(), '', $data, null);
}
public function testStat() {