summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-27 13:41:23 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-27 13:41:23 +0200
commit79da35b698a398bef59f83f222de3055ddbb5a92 (patch)
tree00a743b4b5b2537eda68262d4e895a7ea9d464f5 /tests
parentb11d8799c17b24e7823de8d8dc171fb78f9b8442 (diff)
downloadnextcloud-server-79da35b698a398bef59f83f222de3055ddbb5a92.tar.gz
nextcloud-server-79da35b698a398bef59f83f222de3055ddbb5a92.zip
code cleanup
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/connector/sabre/objecttree.php61
1 files changed, 22 insertions, 39 deletions
diff --git a/tests/lib/connector/sabre/objecttree.php b/tests/lib/connector/sabre/objecttree.php
index c920441c8b4..1d76bb59676 100644
--- a/tests/lib/connector/sabre/objecttree.php
+++ b/tests/lib/connector/sabre/objecttree.php
@@ -36,38 +36,14 @@ class ObjectTree extends PHPUnit_Framework_TestCase {
* @expectedException Sabre_DAV_Exception_Forbidden
*/
public function testMoveFailed($source, $dest, $updatables) {
- $rootDir = new OC_Connector_Sabre_Directory('');
- $objectTree = $this->getMock('\OC\Connector\Sabre\ObjectTree',
- array('nodeExists', 'getNodeForPath'),
- array($rootDir));
-
- $objectTree->expects($this->once())
- ->method('getNodeForPath')
- ->with($this->identicalTo('a/b'))
- ->will($this->returnValue(false));
-
- /** @var $objectTree \OC\Connector\Sabre\ObjectTree */
- $objectTree->fileView = new TestDoubleFileView($updatables);
- $objectTree->move($source, $dest);
+ $this->moveTest($source, $dest, $updatables);
}
/**
* @dataProvider moveSuccessProvider
*/
public function testMoveSuccess($source, $dest, $updatables) {
- $rootDir = new OC_Connector_Sabre_Directory('');
- $objectTree = $this->getMock('\OC\Connector\Sabre\ObjectTree',
- array('nodeExists', 'getNodeForPath'),
- array($rootDir));
-
- $objectTree->expects($this->once())
- ->method('getNodeForPath')
- ->with($this->identicalTo('a/b'))
- ->will($this->returnValue(false));
-
- /** @var $objectTree \OC\Connector\Sabre\ObjectTree */
- $objectTree->fileView = new TestDoubleFileView($updatables);
- $objectTree->move($source, $dest);
+ $this->moveTest($source, $dest, $updatables);
$this->assertTrue(true);
}
@@ -87,18 +63,25 @@ class ObjectTree extends PHPUnit_Framework_TestCase {
);
}
-// private function buildFileViewMock($updatables) {
-// // mock filesysten
-// $view = $this->getMock('\OC\Files\View', array('isUpdatable'), array(), '', FALSE);
-//
-// foreach ($updatables as $path => $updatable) {
-// $view->expects($this->any())
-// ->method('isUpdatable')
-// ->with($this->identicalTo($path))
-// ->will($this->returnValue($updatable));
-// }
-//
-// return $view;
-// }
+ /**
+ * @param $source
+ * @param $dest
+ * @param $updatables
+ */
+ private function moveTest($source, $dest, $updatables) {
+ $rootDir = new OC_Connector_Sabre_Directory('');
+ $objectTree = $this->getMock('\OC\Connector\Sabre\ObjectTree',
+ array('nodeExists', 'getNodeForPath'),
+ array($rootDir));
+
+ $objectTree->expects($this->once())
+ ->method('getNodeForPath')
+ ->with($this->identicalTo($source))
+ ->will($this->returnValue(false));
+
+ /** @var $objectTree \OC\Connector\Sabre\ObjectTree */
+ $objectTree->fileView = new TestDoubleFileView($updatables);
+ $objectTree->move($source, $dest);
+ }
}