summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre/FileTest.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-02-24 11:56:29 +0100
committerJoas Schilling <coding@schilljs.com>2017-04-27 09:29:02 +0200
commit614bd5c29419c9f45d4fa826539c544a6d7c2e26 (patch)
tree2d2d0cecc5cd788ee44775c893280567ef658d22 /apps/dav/tests/unit/Connector/Sabre/FileTest.php
parent53deb26778c674760acd0bc3ca08e8fbc607a034 (diff)
downloadnextcloud-server-614bd5c29419c9f45d4fa826539c544a6d7c2e26.tar.gz
nextcloud-server-614bd5c29419c9f45d4fa826539c544a6d7c2e26.zip
Properly handle missing READ permission
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre/FileTest.php')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index 31344b36463..81b7ad27d6a 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -1003,4 +1003,23 @@ class FileTest extends \Test\TestCase {
$file->get();
}
+
+ /**
+ * @expectedException \Sabre\DAV\Exception\NotFound
+ */
+ public function testGetThrowsIfNoPermission() {
+ $view = $this->getMockBuilder(View::class)
+ ->setMethods(['fopen'])
+ ->getMock();
+ $view->expects($this->never())
+ ->method('fopen');
+
+ $info = new FileInfo('/test.txt', $this->getMockStorage(), null, [
+ 'permissions' => Constants::PERMISSION_CREATE // no read perm
+ ], null);
+
+ $file = new File($view, $info);
+
+ $file->get();
+ }
}