From fb4cf532533d99abfd1b4f40ef6319d484f6ef85 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 13 Mar 2015 17:43:38 +0100 Subject: Fix mount config unit tests Fix expected result now that it returns the status. Added isset for some properties that are not always present. --- apps/files_external/lib/config.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'apps/files_external/lib/config.php') diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 378bedfa8de..23750dbb3fa 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -347,8 +347,6 @@ class OC_Mount_Config { $mountPoint = substr($mountPoint, 13); $config = array( - 'id' => (int) $mount['id'], - 'storage_id' => (int) $mount['storage_id'], 'class' => $mount['class'], 'mountpoint' => $mountPoint, 'backend' => $backends[$mount['class']]['backend'], @@ -357,6 +355,12 @@ class OC_Mount_Config { 'applicable' => array('groups' => array($group), 'users' => array()), 'status' => self::getBackendStatus($mount['class'], $mount['options'], false) ); + if (isset($mount['id'])) { + $config['id'] = (int)$mount['id']; + } + if (isset($mount['storage_id'])) { + $config['storage_id'] = (int)$mount['storage_id']; + } if (isset($mount['mountOptions'])) { $config['mountOptions'] = $mount['mountOptions']; } @@ -386,8 +390,6 @@ class OC_Mount_Config { // Remove '/$user/files/' from mount point $mountPoint = substr($mountPoint, 13); $config = array( - 'id' => (int) $mount['id'], - 'storage_id' => (int) $mount['storage_id'], 'class' => $mount['class'], 'mountpoint' => $mountPoint, 'backend' => $backends[$mount['class']]['backend'], @@ -396,6 +398,12 @@ class OC_Mount_Config { 'applicable' => array('groups' => array(), 'users' => array($user)), 'status' => self::getBackendStatus($mount['class'], $mount['options'], false) ); + if (isset($mount['id'])) { + $config['id'] = (int)$mount['id']; + } + if (isset($mount['storage_id'])) { + $config['storage_id'] = (int)$mount['storage_id']; + } if (isset($mount['mountOptions'])) { $config['mountOptions'] = $mount['mountOptions']; } @@ -433,8 +441,6 @@ class OC_Mount_Config { } $mount['options'] = self::decryptPasswords($mount['options']); $config = array( - 'id' => (int) $mount['id'], - 'storage_id' => (int) $mount['storage_id'], 'class' => $mount['class'], // Remove '/uid/files/' from mount point 'mountpoint' => substr($mountPoint, strlen($uid) + 8), @@ -442,6 +448,12 @@ class OC_Mount_Config { 'options' => $mount['options'], 'status' => self::getBackendStatus($mount['class'], $mount['options'], true) ); + if (isset($mount['id'])) { + $config['id'] = (int)$mount['id']; + } + if (isset($mount['storage_id'])) { + $config['storage_id'] = (int)$mount['storage_id']; + } if (isset($mount['mountOptions'])) { $config['mountOptions'] = $mount['mountOptions']; } -- cgit v1.2.3