|
29 | 29 | namespace OCA\DAV\Tests\Unit\Connector\Sabre; |
30 | 30 |
|
31 | 31 | use OC\Files\FileInfo; |
| 32 | +use OC\Files\Filesystem; |
32 | 33 | use OC\Files\Node\Node; |
33 | 34 | use OC\Files\Storage\Wrapper\Quota; |
| 35 | +use OC\Files\View; |
34 | 36 | use OCA\DAV\Connector\Sabre\Directory; |
| 37 | +use OCP\Constants; |
35 | 38 | use OCP\Files\ForbiddenException; |
36 | 39 | use OCP\Files\Mount\IMountPoint; |
37 | 40 | use Test\Traits\UserTrait; |
@@ -91,6 +94,10 @@ protected function setUp(): void { |
91 | 94 | ->willReturn(Node::TYPE_FOLDER); |
92 | 95 | $this->info->method('getName') |
93 | 96 | ->willReturn("folder"); |
| 97 | + $this->info->method('getPath') |
| 98 | + ->willReturn("/admin/files/folder"); |
| 99 | + $this->info->method('getPermissions') |
| 100 | + ->willReturn(Constants::PERMISSION_READ); |
94 | 101 | } |
95 | 102 |
|
96 | 103 | private function getDir($path = '/') { |
@@ -207,12 +214,21 @@ public function testGetChildren(): void { |
207 | 214 |
|
208 | 215 | $this->view->expects($this->once()) |
209 | 216 | ->method('getDirectoryContent') |
210 | | - ->with('') |
211 | 217 | ->willReturn([$info1, $info2]); |
212 | 218 |
|
213 | 219 | $this->view->expects($this->any()) |
214 | 220 | ->method('getRelativePath') |
215 | | - ->willReturn(''); |
| 221 | + ->willReturnCallback(function ($path) { |
| 222 | + return str_replace('/admin/files/', '', $path); |
| 223 | + }); |
| 224 | + |
| 225 | + $this->view->expects($this->any()) |
| 226 | + ->method('getAbsolutePath') |
| 227 | + ->willReturnCallback(function ($path) { |
| 228 | + return Filesystem::normalizePath('/admin/files' . $path); |
| 229 | + }); |
| 230 | + |
| 231 | + $this->overwriteService(View::class, $this->view); |
216 | 232 |
|
217 | 233 | $dir = new Directory($this->view, $this->info); |
218 | 234 | $nodes = $dir->getChildren(); |
|
0 commit comments