Fix fed share test call to return proper result
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>
This commit is contained in:
parent
e0dd6768be
commit
335fcb1a43
|
@ -186,7 +186,7 @@ class Storage extends DAV implements ISharedStorage {
|
||||||
|
|
||||||
public function test() {
|
public function test() {
|
||||||
try {
|
try {
|
||||||
parent::test();
|
return parent::test();
|
||||||
} catch (StorageInvalidException $e) {
|
} catch (StorageInvalidException $e) {
|
||||||
// check if it needs to be removed
|
// check if it needs to be removed
|
||||||
$this->checkStorageAvailability();
|
$this->checkStorageAvailability();
|
||||||
|
|
|
@ -67,14 +67,11 @@ class ExternalStorageTest extends \Test\TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function getTestStorage($uri) {
|
||||||
* @dataProvider optionsProvider
|
|
||||||
*/
|
|
||||||
public function testStorageMountOptions($inputUri, $baseUri) {
|
|
||||||
$certificateManager = \OC::$server->getCertificateManager();
|
$certificateManager = \OC::$server->getCertificateManager();
|
||||||
$storage = new TestSharingExternalStorage(
|
return new TestSharingExternalStorage(
|
||||||
array(
|
array(
|
||||||
'remote' => $inputUri,
|
'remote' => $uri,
|
||||||
'owner' => 'testOwner',
|
'owner' => 'testOwner',
|
||||||
'mountpoint' => 'remoteshare',
|
'mountpoint' => 'remoteshare',
|
||||||
'token' => 'abcdef',
|
'token' => 'abcdef',
|
||||||
|
@ -83,8 +80,20 @@ class ExternalStorageTest extends \Test\TestCase {
|
||||||
'certificateManager' => $certificateManager
|
'certificateManager' => $certificateManager
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider optionsProvider
|
||||||
|
*/
|
||||||
|
public function testStorageMountOptions($inputUri, $baseUri) {
|
||||||
|
$storage = $this->getTestStorage($inputUri);
|
||||||
$this->assertEquals($baseUri, $storage->getBaseUri());
|
$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() {
|
public function getBaseUri() {
|
||||||
return $this->createBaseUri();
|
return $this->createBaseUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function stat($path) {
|
||||||
|
if ($path === '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::stat($path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue