aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/mountconfig.php
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2014-05-14 22:34:38 +0100
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2014-05-21 22:18:22 +0100
commit0a8a3199158a7a52c071054df4b4d740c90db5ac (patch)
treeb21553e1bedaad63d28aa5645484301a9ac1324b /apps/files_external/tests/mountconfig.php
parenteae45dca71a089aa72cc780ecee7a9d7dd9ab3a1 (diff)
downloadnextcloud-server-0a8a3199158a7a52c071054df4b4d740c90db5ac.tar.gz
nextcloud-server-0a8a3199158a7a52c071054df4b4d740c90db5ac.zip
Fix priority merging logic and add unit test
Diffstat (limited to 'apps/files_external/tests/mountconfig.php')
-rw-r--r--apps/files_external/tests/mountconfig.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/files_external/tests/mountconfig.php b/apps/files_external/tests/mountconfig.php
index 33cbd10d9e9..9b04e200e2b 100644
--- a/apps/files_external/tests/mountconfig.php
+++ b/apps/files_external/tests/mountconfig.php
@@ -752,4 +752,52 @@ class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
$this->assertEquals(1, count($mountPoints));
$this->assertEquals($expected, $mountPoints['/'.self::TEST_USER1.'/files/ext']['options']['id']);
}
+
+ /**
+ * Test for persistence of priority when changing mount options
+ */
+ public function testPriorityPersistence() {
+ $class = '\OC\Files\Storage\SMB';
+ $priority = 123;
+ $mountConfig = array(
+ 'host' => 'somehost',
+ 'user' => 'someuser',
+ 'password' => 'somepassword',
+ 'root' => 'someroot'
+ );
+
+ $this->assertTrue(
+ OC_Mount_Config::addMountPoint(
+ '/ext',
+ $class,
+ $mountConfig,
+ OC_Mount_Config::MOUNT_TYPE_USER,
+ self::TEST_USER1,
+ false,
+ $priority
+ )
+ );
+
+ // Check for correct priority
+ $mountPoints = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER1);
+ $this->assertEquals($priority,
+ $mountPoints['/'.self::TEST_USER1.'/files/ext']['priority']);
+
+ // Simulate changed mount options (without priority set)
+ $this->assertTrue(
+ OC_Mount_Config::addMountPoint(
+ '/ext',
+ $class,
+ $mountConfig,
+ OC_Mount_Config::MOUNT_TYPE_USER,
+ self::TEST_USER1,
+ false
+ )
+ );
+
+ // Check for correct priority
+ $mountPoints = OC_Mount_Config::getAbsoluteMountPoints(self::TEST_USER1);
+ $this->assertEquals($priority,
+ $mountPoints['/'.self::TEST_USER1.'/files/ext']['priority']);
+ }
}