diff options
Diffstat (limited to 'tests/lib/connector/sabre/directory.php')
-rw-r--r-- | tests/lib/connector/sabre/directory.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/lib/connector/sabre/directory.php b/tests/lib/connector/sabre/directory.php index c501521b601..b2bf0d4a6d2 100644 --- a/tests/lib/connector/sabre/directory.php +++ b/tests/lib/connector/sabre/directory.php @@ -1,18 +1,32 @@ <?php + /** * Copyright (c) 2013 Thomas Müller <thomas.mueller@tmit.eu> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ - class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase { + private function getRootDir() { + $view = $this->getMock('OC\Files\View', array(), array(), '', false); + $view->expects($this->once()) + ->method('getRelativePath') + ->will($this->returnValue('')); + + $info = $this->getMock('OC\Files\FileInfo', array(), array(), '', false); + $info->expects($this->once()) + ->method('getPath') + ->will($this->returnValue('')); + + return new OC_Connector_Sabre_Directory($view, $info); + } + /** * @expectedException Sabre_DAV_Exception_Forbidden */ public function testCreateSharedFileFails() { - $dir = new OC_Connector_Sabre_Directory(''); + $dir = $this->getRootDir(); $dir->createFile('Shared'); } @@ -20,7 +34,7 @@ class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase { * @expectedException Sabre_DAV_Exception_Forbidden */ public function testCreateSharedFolderFails() { - $dir = new OC_Connector_Sabre_Directory(''); + $dir = $this->getRootDir(); $dir->createDirectory('Shared'); } @@ -28,7 +42,7 @@ class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase { * @expectedException Sabre_DAV_Exception_Forbidden */ public function testDeleteSharedFolderFails() { - $dir = new OC_Connector_Sabre_Directory('Shared'); + $dir = $this->getRootDir(); $dir->delete(); } } |