return new Directory($this->view, $this->info);
}
-
+
public function testDeleteRootFolderFails() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$dir->delete();
}
-
+
public function testDeleteForbidden() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
$dir->delete();
}
-
+
public function testDeleteFolderWhenAllowed() {
// deletion allowed
$this->info->expects($this->once())
$dir->delete();
}
-
+
public function testDeleteFolderFailsWhenNotAllowed() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$dir->delete();
}
-
+
public function testDeleteFolderThrowsWhenDeletionFailed() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$dir->getChildren();
}
-
+
public function testGetChildrenNoPermission() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$dir->getChildren();
}
-
+
public function testGetChildNoPermission() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$dir->getChild('test');
}
-
+
public function testGetChildThrowStorageNotAvailableException() {
$this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
$dir->getChild('.');
}
-
+
public function testGetChildThrowInvalidPath() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
->method('getStorage')
->willReturn($storage);
+ $this->view->expects($this->once())
+ ->method('getFileInfo')
+ ->willReturn($this->info);
+
$dir = new Directory($this->view, $this->info);
$this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited
}
->method('getStorage')
->willReturn($storage);
+ $this->view->expects($this->once())
+ ->method('getFileInfo')
+ ->willReturn($this->info);
+
$dir = new Directory($this->view, $this->info);
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
}
$this->assertTrue($targetNode->moveInto(basename($destination), $source, $sourceNode));
}
-
+
public function testFailingMove() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('Could not copy directory b, target exists');