From aedc59c6364a1fdddf59a6f47f500ce1857797ea Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 1 Dec 2017 12:34:37 +0100 Subject: [PATCH] Fix tests Signed-off-by: Roeland Jago Douma --- apps/dav/lib/Connector/Sabre/ObjectTree.php | 2 +- apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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') -- 2.39.5