|
|
|
|
@ -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(); |
|
|
|
|
|