/** * @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden */ public function testGetFopenThrows() { $view = $this->getMock('\\OC\\Files\\View', ['fopen'], array()); $view->expects($this->atLeastOnce())->method('fopen')->willThrowException(new ForbiddenException('', true)); $info = new \OC\Files\FileInfo('/test.txt', null, null, array('permissions' => \OCP\Constants::PERMISSION_ALL), null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); $file->get(); }
/** * @expectedException \Sabre\DAV\Exception\ServiceUnavailable */ public function testGetFopenFails() { $view = $this->getMock('\\OC\\Files\\View', ['fopen'], array()); $view->expects($this->atLeastOnce())->method('fopen')->will($this->returnValue(false)); $info = new \OC\Files\FileInfo('/test.txt', null, null, array('permissions' => \OCP\Constants::PERMISSION_ALL), null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); $file->get(); }