Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-01-27 02:49:14 +0400
committerRobin Appelman <icewind@owncloud.com>2013-01-27 03:13:49 +0400
commit8c42e2de8c8be9bd5914794dbf01a10f575788d1 (patch)
tree4ab4e23f0dd9f75b145171250a625f1ad8ba2523 /tests
parent69f11151e90f0a17b02e58f7f94ca7f7a521f13a (diff)
Test cases for new mount management
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/mount.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/lib/files/mount.php b/tests/lib/files/mount.php
new file mode 100644
index 00000000000..9f16b036275
--- /dev/null
+++ b/tests/lib/files/mount.php
@@ -0,0 +1,37 @@
+<?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;
+
+use \OC\Files\Storage\Temporary;
+
+class Mount extends \PHPUnit_Framework_TestCase {
+ public function setup() {
+ \OC_Util::setupFS();
+ \OC\Files\Mount::clear();
+ }
+
+ public function testFind() {
+ $this->assertNull(\OC\Files\Mount::find('/'));
+
+ $rootMount = new \OC\Files\Mount(new Temporary(array()), '/');
+ $this->assertEquals($rootMount, \OC\Files\Mount::find('/'));
+ $this->assertEquals($rootMount, \OC\Files\Mount::find('/foo/bar'));
+
+ $mount = new \OC\Files\Mount(new Temporary(array()), '/foo');
+ $this->assertEquals($rootMount, \OC\Files\Mount::find('/'));
+ $this->assertEquals($mount, \OC\Files\Mount::find('/foo/bar'));
+
+ $this->assertEquals(1, count(\OC\Files\Mount::findIn('/')));
+ new \OC\Files\Mount(new Temporary(array()), '/bar');
+ $this->assertEquals(2, count(\OC\Files\Mount::findIn('/')));
+
+ $id = $mount->getStorageId();
+ $this->assertEquals($mount, \OC\Files\Mount::findById($id));
+ }
+}