diff options
author | Robin Appelman <robin@icewind.nl> | 2015-10-19 17:22:42 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2015-10-19 17:22:42 +0300 |
commit | 9c5337ca3eb2bc48599c54ce4699def00a912e3e (patch) | |
tree | 9b92cdc357bd0cfe5c3570b2510010966b07a8f4 | |
parent | 3d4e0ba4e7d6e4b3e9aaf943e3d74d1a5ee9acd2 (diff) | |
parent | d8798877df603a9f095fcf7474ebf7dbb82b2245 (diff) |
Merge pull request #19833 from owncloud/fix_view_rmdir
Removemount expects absolutePath
-rw-r--r-- | lib/private/files/view.php | 2 | ||||
-rw-r--r-- | tests/lib/files/view.php | 49 |
2 files changed, 50 insertions, 1 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 1353fac51ff..04932d69384 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -290,7 +290,7 @@ class View { $absolutePath = $this->getAbsolutePath($path); $mount = Filesystem::getMountManager()->find($absolutePath); if ($mount->getInternalPath($absolutePath) === '') { - return $this->removeMount($mount, $path); + return $this->removeMount($mount, $absolutePath); } if ($this->is_dir($path)) { return $this->basicOperation('rmdir', $path, array('delete')); diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 94f9e209152..c0845a5613c 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -2275,4 +2275,53 @@ class View extends \Test\TestCase { } return null; } + + + public function testRemoveMoveableMountPoint() { + $mountPoint = '/' . $this->user . '/files/mount/'; + + // Mock the mount point + $mount = $this->getMockBuilder('\Test\TestMoveableMountPoint') + ->disableOriginalConstructor() + ->getMock(); + $mount->expects($this->once()) + ->method('getMountPoint') + ->willReturn($mountPoint); + $mount->expects($this->once()) + ->method('removeMount') + ->willReturn('foo'); + $mount->expects($this->any()) + ->method('getInternalPath') + ->willReturn(''); + + // Register mount + \OC\Files\Filesystem::getMountManager()->addMount($mount); + + // Listen for events + $eventHandler = $this->getMockBuilder('\stdclass') + ->setMethods(['umount', 'post_umount']) + ->getMock(); + $eventHandler->expects($this->once()) + ->method('umount') + ->with([\OC\Files\Filesystem::signal_param_path => '/mount']); + $eventHandler->expects($this->once()) + ->method('post_umount') + ->with([\OC\Files\Filesystem::signal_param_path => '/mount']); + \OCP\Util::connectHook( + \OC\Files\Filesystem::CLASSNAME, + 'umount', + $eventHandler, + 'umount' + ); + \OCP\Util::connectHook( + \OC\Files\Filesystem::CLASSNAME, + 'post_umount', + $eventHandler, + 'post_umount' + ); + + //Delete the mountpoint + $view = new \OC\Files\View('/' . $this->user . '/files'); + $this->assertEquals('foo', $view->rmdir('mount')); + } } |