summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-11-16 11:07:26 +0100
committerRobin Appelman <robin@icewind.nl>2016-11-16 15:30:37 +0100
commit4ac5fdcf11b0ca7dd985d50a91393a1c185821ff (patch)
treec6b9d1f14d38c8afcad7ea514bfaaa6acd5cbc6c
parente4d1cf0f6db28ba371c9b1ce1cbbe35d535f8c8d (diff)
downloadnextcloud-server-4ac5fdcf11b0ca7dd985d50a91393a1c185821ff.tar.gz
nextcloud-server-4ac5fdcf11b0ca7dd985d50a91393a1c185821ff.zip
add tests for FileInfo::isMounted
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--tests/lib/Files/FileInfoTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/lib/Files/FileInfoTest.php b/tests/lib/Files/FileInfoTest.php
new file mode 100644
index 00000000000..ee7a10ccec4
--- /dev/null
+++ b/tests/lib/Files/FileInfoTest.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Copyright (c) 2016 Robin Appelman <robin@icewind.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files;
+
+use OC\AllConfig;
+use OC\Files\FileInfo;
+use OC\Files\Storage\Home;
+use OC\Files\Storage\Temporary;
+use OC\User\User;
+use OCP\IConfig;
+use Test\TestCase;
+use Test\Traits\UserTrait;
+
+class FileInfoTest extends TestCase {
+ use UserTrait;
+
+ private $config;
+
+ public function setUp() {
+ parent::setUp();
+ $this->createUser('foo', 'foo');
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ }
+
+ public function testIsMountedHomeStorage() {
+ $fileInfo = new FileInfo(
+ '',
+ new Home(['user' => new User('foo', $this->userBackend, null, $this->config)]),
+ '', [], null);
+ $this->assertFalse($fileInfo->isMounted());
+ }
+
+ public function testIsMountedNonHomeStorage() {
+ $fileInfo = new FileInfo(
+ '',
+ new Temporary(),
+ '', [], null);
+ $this->assertTrue($fileInfo->isMounted());
+ }
+}