Skip to content

Commit a61fb3d

Browse files
committed
update tests
Signed-off-by: Robin Appelman <[email protected]>
1 parent 776eb52 commit a61fb3d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
namespace OCA\DAV\Tests\Unit\Connector\Sabre;
3030

3131
use OC\Files\FileInfo;
32+
use OC\Files\Node\Node;
3233
use OC\Files\Storage\Wrapper\Quota;
3334
use OCA\DAV\Connector\Sabre\Directory;
3435
use OCP\Files\ForbiddenException;
@@ -82,9 +83,10 @@ protected function setUp(): void {
8283

8384
$this->view = $this->createMock('OC\Files\View');
8485
$this->info = $this->createMock('OC\Files\FileInfo');
85-
$this->info->expects($this->any())
86-
->method('isReadable')
86+
$this->info->method('isReadable')
8787
->willReturn(true);
88+
$this->info->method('getType')
89+
->willReturn(Node::TYPE_FOLDER);
8890
}
8991

9092
private function getDir($path = '/') {

apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,14 @@ public function testGetNodeForPath(
167167
$fileInfo = $this->getMockBuilder(FileInfo::class)
168168
->disableOriginalConstructor()
169169
->getMock();
170-
$fileInfo->expects($this->once())
171-
->method('getType')
170+
$fileInfo->method('getType')
172171
->willReturn($type);
173-
$fileInfo->expects($this->once())
174-
->method('getName')
172+
$fileInfo->method('getName')
175173
->willReturn($outputFileName);
176174
$fileInfo->method('getStorage')
177175
->willReturn($this->createMock(\OC\Files\Storage\Common::class));
178176

179-
$view->expects($this->once())
180-
->method('getFileInfo')
177+
$view->method('getFileInfo')
181178
->with($fileInfoQueryPath)
182179
->willReturn($fileInfo);
183180

apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ public function testGetProperties($shareTypes) {
111111
->disableOriginalConstructor()
112112
->getMock();
113113

114-
$this->userFolder->expects($this->once())
115-
->method('get')
116-
->with('/subdir')
114+
$sabreNode->method('getNode')
117115
->willReturn($node);
118116

119117
$this->shareManager->expects($this->any())
@@ -187,9 +185,12 @@ public function testPreloadThenGetProperties($shareTypes) {
187185
$node2->method('getId')
188186
->willReturn(222);
189187

190-
$this->userFolder->method('get')
191-
->with('/subdir')
188+
$sabreNode->method('getNode')
192189
->willReturn($node);
190+
$sabreNode1->method('getNode')
191+
->willReturn($node1);
192+
$sabreNode2->method('getNode')
193+
->willReturn($node2);
193194

194195
$dummyShares = array_map(function ($type) {
195196
$share = $this->getMockBuilder(IShare::class)->getMock();

0 commit comments

Comments
 (0)