aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
index c6365cf3168..b0d3bdd8ec7 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -29,9 +29,12 @@
namespace OCA\DAV\Tests\Unit\Connector\Sabre;
use OC\Files\FileInfo;
+use OC\Files\Filesystem;
use OC\Files\Node\Node;
use OC\Files\Storage\Wrapper\Quota;
+use OC\Files\View;
use OCA\DAV\Connector\Sabre\Directory;
+use OCP\Constants;
use OCP\Files\ForbiddenException;
use OCP\Files\Mount\IMountPoint;
use Test\Traits\UserTrait;
@@ -91,6 +94,10 @@ class DirectoryTest extends \Test\TestCase {
->willReturn(Node::TYPE_FOLDER);
$this->info->method('getName')
->willReturn("folder");
+ $this->info->method('getPath')
+ ->willReturn("/admin/files/folder");
+ $this->info->method('getPermissions')
+ ->willReturn(Constants::PERMISSION_READ);
}
private function getDir($path = '/') {
@@ -207,12 +214,21 @@ class DirectoryTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getDirectoryContent')
- ->with('')
->willReturn([$info1, $info2]);
$this->view->expects($this->any())
->method('getRelativePath')
- ->willReturn('');
+ ->willReturnCallback(function($path) {
+ return str_replace('/admin/files/', '', $path);
+ });
+
+ $this->view->expects($this->any())
+ ->method('getAbsolutePath')
+ ->willReturnCallback(function($path) {
+ return Filesystem::normalizePath('/admin/files' . $path);
+ });
+
+ $this->overwriteService(View::class, $this->view);
$dir = new Directory($this->view, $this->info);
$nodes = $dir->getChildren();