]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix fed share test call to return proper result 1515/head
authorVincent Petry <pvince81@owncloud.com>
Tue, 6 Sep 2016 10:57:14 +0000 (12:57 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Mon, 26 Sep 2016 09:17:57 +0000 (11:17 +0200)
Fixes an issue where retrying a previously failed federated share would
not properly reset the availability flag because the return value was
undefined instead of "true".

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
apps/files_sharing/lib/External/Storage.php
apps/files_sharing/tests/ExternalStorageTest.php

index 1ed6375cd4f748b1fd6e36a037fe327015a48b43..caa2bcf2a7984d860394988164afeeb843a3fbb7 100644 (file)
@@ -186,7 +186,7 @@ class Storage extends DAV implements ISharedStorage {
 
        public function test() {
                try {
-                       parent::test();
+                       return parent::test();
                } catch (StorageInvalidException $e) {
                        // check if it needs to be removed
                        $this->checkStorageAvailability();
index 48c348667c55ff4ae467c2e8a088dc7b52bea273..e84d2bb0e1701d9c8e4cd291775630c41be7edac 100644 (file)
@@ -67,14 +67,11 @@ class ExternalStorageTest extends \Test\TestCase {
                );
        }
 
-       /**
-        * @dataProvider optionsProvider
-        */
-       public function testStorageMountOptions($inputUri, $baseUri) {
+       private function getTestStorage($uri) {
                $certificateManager = \OC::$server->getCertificateManager();
-               $storage = new TestSharingExternalStorage(
+               return new TestSharingExternalStorage(
                        array(
-                               'remote' => $inputUri,
+                               'remote' => $uri,
                                'owner' => 'testOwner',
                                'mountpoint' => 'remoteshare',
                                'token' => 'abcdef',
@@ -83,8 +80,20 @@ class ExternalStorageTest extends \Test\TestCase {
                                'certificateManager' => $certificateManager
                        )
                );
+       }
+
+       /**
+        * @dataProvider optionsProvider
+        */
+       public function testStorageMountOptions($inputUri, $baseUri) {
+               $storage = $this->getTestStorage($inputUri);
                $this->assertEquals($baseUri, $storage->getBaseUri());
        }
+
+       public function testIfTestReturnsTheValue() {
+               $result = $this->getTestStorage('https://remoteserver')->test();
+               $this->assertSame(true, $result);
+       }
 }
 
 /**
@@ -95,4 +104,11 @@ class TestSharingExternalStorage extends \OCA\Files_Sharing\External\Storage {
        public function getBaseUri() {
                return $this->createBaseUri();
        }
+
+       public function stat($path) {
+               if ($path === '') {
+                       return true;
+               }
+               return parent::stat($path);
+       }
 }