summaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Mount/MountTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/Mount/MountTest.php')
-rw-r--r--tests/lib/Files/Mount/MountTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/lib/Files/Mount/MountTest.php b/tests/lib/Files/Mount/MountTest.php
new file mode 100644
index 00000000000..f21095f2fa5
--- /dev/null
+++ b/tests/lib/Files/Mount/MountTest.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files\Mount;
+
+
+use OC\Files\Storage\StorageFactory;
+use OC\Files\Storage\Wrapper\Wrapper;
+
+class MountTest extends \Test\TestCase {
+ public function testFromStorageObject() {
+ $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $mount = new \OC\Files\Mount\MountPoint($storage, '/foo');
+ $this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
+ }
+
+ public function testFromStorageClassname() {
+ $mount = new \OC\Files\Mount\MountPoint('\OC\Files\Storage\Temporary', '/foo');
+ $this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
+ }
+
+ public function testWrapper() {
+ $test = $this;
+ $wrapper = function ($mountPoint, $storage) use (&$test) {
+ $test->assertEquals('/foo/', $mountPoint);
+ $test->assertInstanceOf('\OC\Files\Storage\Storage', $storage);
+ return new Wrapper(array('storage' => $storage));
+ };
+
+ $loader = new StorageFactory();
+ $loader->addStorageWrapper('test_wrapper', $wrapper);
+
+ $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $mount = new \OC\Files\Mount\MountPoint($storage, '/foo', array(), $loader);
+ $this->assertInstanceOf('\OC\Files\Storage\Wrapper\Wrapper', $mount->getStorage());
+ }
+}