Esempio n. 1
0
 public function testMoveSrcDeletable()
 {
     $fileInfoFolderATestTXT = $this->getMockBuilder('\\OCP\\Files\\FileInfo')->disableOriginalConstructor()->getMock();
     $fileInfoFolderATestTXT->expects($this->once())->method('isDeletable')->willReturn(true);
     $this->view->expects($this->once())->method('getFileInfo')->with('FolderA/test.txt')->willReturn($fileInfoFolderATestTXT);
     $this->plugin->checkMove('FolderA/test.txt', 'test.txt');
 }
Esempio n. 2
0
 /**
  * @dataProvider downloadHeadersProvider
  */
 public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader)
 {
     $request = $this->getMockBuilder('Sabre\\HTTP\\RequestInterface')->disableOriginalConstructor()->getMock();
     $response = $this->getMockBuilder('Sabre\\HTTP\\ResponseInterface')->disableOriginalConstructor()->getMock();
     $request->expects($this->once())->method('getPath')->will($this->returnValue('test/somefile.xml'));
     $node = $this->getMockBuilder('\\OCA\\DAV\\Connector\\Sabre\\File')->disableOriginalConstructor()->getMock();
     $node->expects($this->once())->method('getName')->will($this->returnValue('somefile.xml'));
     $this->tree->expects($this->once())->method('getNodeForPath')->with('test/somefile.xml')->will($this->returnValue($node));
     $this->request->expects($this->once())->method('isUserAgent')->will($this->returnValue($isClumsyAgent));
     $response->expects($this->once())->method('addHeader')->with('Content-Disposition', $contentDispositionHeader);
     $this->plugin->httpGet($request, $response);
 }
Esempio n. 3
0
 /**
  * @expectedException \Sabre\DAV\Exception\NotFound
  * @expectedExceptionMessage FolderA/test.txt does not exist
  */
 public function testMoveSrcNotExist()
 {
     $this->view->expects($this->once())->method('getFileInfo')->with('FolderA/test.txt')->willReturn(false);
     $this->plugin->checkMove('FolderA/test.txt', 'test.txt');
 }