From: Roeland Jago Douma Date: Fri, 1 Dec 2017 11:34:37 +0000 (+0100) Subject: Fix tests X-Git-Tag: v12.0.5RC1~36^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F7407%2Fhead;p=nextcloud-server.git Fix tests Signed-off-by: Roeland Jago Douma --- diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index f37ffc19e29..bd2da1d25b2 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -160,7 +160,7 @@ class ObjectTree extends \Sabre\DAV\Tree { try { $info = $this->fileView->getFileInfo($path); - if ($info->getStorage()->instanceOfStorage(FailedStorage::class)) { + if ($info instanceof \OCP\Files\FileInfo && $info->getStorage()->instanceOfStorage(FailedStorage::class)) { throw new StorageNotAvailableException(); } } catch (StorageNotAvailableException $e) { diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 53f60bd0f1c..efb6d88ae57 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -174,6 +174,8 @@ class ObjectTreeTest extends \Test\TestCase { $fileInfo->expects($this->once()) ->method('getName') ->will($this->returnValue($outputFileName)); + $fileInfo->method('getStorage') + ->willReturn($this->createMock(\OC\Files\Storage\Common::class)); $view->expects($this->once()) ->method('getFileInfo')