/** * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testDeleteThrowsWhenDeletionFailed() { // setup $view = $this->getMock('\\OC\\Files\\View', array()); // but fails $view->expects($this->once())->method('unlink')->will($this->returnValue(false)); $info = new \OC\Files\FileInfo('/test.txt', null, null, array('permissions' => \OCP\Constants::PERMISSION_ALL), null); $file = new OC_Connector_Sabre_File($view, $info); // action $file->delete(); }