Skip to content

Commit 7841f97

Browse files
authored
Merge pull request #1515 from nextcloud/stable9.1-fed-share-retry
[stable10] Fix fed share test call to return proper result
2 parents 1a1ec21 + 335fcb1 commit 7841f97

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

Diff for: apps/files_sharing/lib/External/Storage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function hasUpdated($path, $time) {
186186

187187
public function test() {
188188
try {
189-
parent::test();
189+
return parent::test();
190190
} catch (StorageInvalidException $e) {
191191
// check if it needs to be removed
192192
$this->checkStorageAvailability();

Diff for: apps/files_sharing/tests/ExternalStorageTest.php

+22-6
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,11 @@ function optionsProvider() {
6767
);
6868
}
6969

70-
/**
71-
* @dataProvider optionsProvider
72-
*/
73-
public function testStorageMountOptions($inputUri, $baseUri) {
70+
private function getTestStorage($uri) {
7471
$certificateManager = \OC::$server->getCertificateManager();
75-
$storage = new TestSharingExternalStorage(
72+
return new TestSharingExternalStorage(
7673
array(
77-
'remote' => $inputUri,
74+
'remote' => $uri,
7875
'owner' => 'testOwner',
7976
'mountpoint' => 'remoteshare',
8077
'token' => 'abcdef',
@@ -83,8 +80,20 @@ public function testStorageMountOptions($inputUri, $baseUri) {
8380
'certificateManager' => $certificateManager
8481
)
8582
);
83+
}
84+
85+
/**
86+
* @dataProvider optionsProvider
87+
*/
88+
public function testStorageMountOptions($inputUri, $baseUri) {
89+
$storage = $this->getTestStorage($inputUri);
8690
$this->assertEquals($baseUri, $storage->getBaseUri());
8791
}
92+
93+
public function testIfTestReturnsTheValue() {
94+
$result = $this->getTestStorage('https://remoteserver')->test();
95+
$this->assertSame(true, $result);
96+
}
8897
}
8998

9099
/**
@@ -95,4 +104,11 @@ class TestSharingExternalStorage extends \OCA\Files_Sharing\External\Storage {
95104
public function getBaseUri() {
96105
return $this->createBaseUri();
97106
}
107+
108+
public function stat($path) {
109+
if ($path === '') {
110+
return true;
111+
}
112+
return parent::stat($path);
113+
}
98114
}

0 commit comments

Comments
 (0)