code cleanup
This commit is contained in:
parent
b11d8799c1
commit
79da35b698
|
@ -36,38 +36,14 @@ class ObjectTree extends PHPUnit_Framework_TestCase {
|
||||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
* @expectedException Sabre_DAV_Exception_Forbidden
|
||||||
*/
|
*/
|
||||||
public function testMoveFailed($source, $dest, $updatables) {
|
public function testMoveFailed($source, $dest, $updatables) {
|
||||||
$rootDir = new OC_Connector_Sabre_Directory('');
|
$this->moveTest($source, $dest, $updatables);
|
||||||
$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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider moveSuccessProvider
|
* @dataProvider moveSuccessProvider
|
||||||
*/
|
*/
|
||||||
public function testMoveSuccess($source, $dest, $updatables) {
|
public function testMoveSuccess($source, $dest, $updatables) {
|
||||||
$rootDir = new OC_Connector_Sabre_Directory('');
|
$this->moveTest($source, $dest, $updatables);
|
||||||
$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->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,18 +63,25 @@ class ObjectTree extends PHPUnit_Framework_TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private function buildFileViewMock($updatables) {
|
/**
|
||||||
// // mock filesysten
|
* @param $source
|
||||||
// $view = $this->getMock('\OC\Files\View', array('isUpdatable'), array(), '', FALSE);
|
* @param $dest
|
||||||
//
|
* @param $updatables
|
||||||
// foreach ($updatables as $path => $updatable) {
|
*/
|
||||||
// $view->expects($this->any())
|
private function moveTest($source, $dest, $updatables) {
|
||||||
// ->method('isUpdatable')
|
$rootDir = new OC_Connector_Sabre_Directory('');
|
||||||
// ->with($this->identicalTo($path))
|
$objectTree = $this->getMock('\OC\Connector\Sabre\ObjectTree',
|
||||||
// ->will($this->returnValue($updatable));
|
array('nodeExists', 'getNodeForPath'),
|
||||||
// }
|
array($rootDir));
|
||||||
//
|
|
||||||
// return $view;
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue