Skip to content

Commit

Permalink
Expunge expects from unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanAckermann committed Oct 13, 2021
1 parent e2dca67 commit 8233bf3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ public function testCheckPropfindInvalidPath() {
$this->plugin->initialize($this->server);

$sabreRequest = $this->getMockBuilder(RequestInterface::class)->disableOriginalConstructor()->getMock();
$sabreRequest->expects($this->exactly(1))->method('getPath')->willReturn('/invalid/path');
$sabreRequest->method('getPath')->willReturn('/invalid/path');

$this->plugin->checkPropFind($sabreRequest);
}
Expand All @@ -666,25 +666,25 @@ public function testCheckPropfindInsufficientPermissions() {
$node = $this->createMock(Node::class);

$shareMock = $this->createMock(IShare::class);
$shareMock->expects($this->once())->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_CREATE);
$shareMock->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_CREATE);

$storage = $this->createMock(SharedStorage::class);
$storage->expects($this->any())->method('instanceOfStorage')->willReturn(true);
$storage->expects($this->once())->method('getShare')->willReturn($shareMock);
$storage->method('instanceOfStorage')->willReturn(true);
$storage->method('getShare')->willReturn($shareMock);
$mount = new MountPoint($storage, '/user2/files/sharedfolder', [[]], Filesystem::getLoader());
Filesystem::getMountManager()->addMount($mount);

$fileInfo = $this->createMock(FileInfo::class);
$fileInfo->expects($this->once())->method('getPath')->willReturn('user2/files/sharedfolder');
$fileInfo->method('getPath')->willReturn('user2/files/sharedfolder');

$node->expects($this->once())->method('getFileInfo')->willReturn($fileInfo);
$node->method('getFileInfo')->willReturn($fileInfo);

$this->tree->expects($this->once())->method('getNodeForPath')->willReturn($node);
$this->tree->method('getNodeForPath')->willReturn($node);
$this->server->tree = $this->tree;
$this->plugin->initialize($this->server);

$sabreRequest = $this->getMockBuilder(RequestInterface::class)->disableOriginalConstructor()->getMock();
$sabreRequest->expects($this->exactly(1))->method('getPath')->willReturn('user2/files/sharedfolder');
$sabreRequest->method('getPath')->willReturn('user2/files/sharedfolder');

$this->plugin->checkPropFind($sabreRequest);
Filesystem::getMountManager()->removeMount('/user2/files/sharedfolder');
Expand Down

0 comments on commit 8233bf3

Please sign in to comment.