diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2015-10-16 16:51:44 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-10-16 16:51:44 +0200 |
commit | d8798877df603a9f095fcf7474ebf7dbb82b2245 (patch) | |
tree | e24a06151fd1fe8dbd79e311c587aba399aa917d /tests | |
parent | 3a14cfc2957b69476da0bc9e513ee6cf6ca0cfb1 (diff) | |
download | nextcloud-server-d8798877df603a9f095fcf7474ebf7dbb82b2245.tar.gz nextcloud-server-d8798877df603a9f095fcf7474ebf7dbb82b2245.zip |
Added test for rmdir on moveablemount
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/view.php | 49 |
1 files changed, 49 insertions, 0 deletions
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')); + } } |