summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/tests
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-05-17 14:39:49 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-05-20 15:55:16 +0200
commit2727c57ae8d0a2d36d9c5cad39790a6640401cac (patch)
tree46a21824d74e89475b0cd90a03e444fa0092221a /apps/federatedfilesharing/tests
parent87ce03db1ac8f1d7313850128528e5b8f06fce66 (diff)
downloadnextcloud-server-2727c57ae8d0a2d36d9c5cad39790a6640401cac.tar.gz
nextcloud-server-2727c57ae8d0a2d36d9c5cad39790a6640401cac.zip
Port admin federated files sharing to vue
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/federatedfilesharing/tests')
-rw-r--r--apps/federatedfilesharing/tests/Settings/AdminTest.php40
1 files changed, 27 insertions, 13 deletions
diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php
index 0b3a721d7da..04761e35410 100644
--- a/apps/federatedfilesharing/tests/Settings/AdminTest.php
+++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php
@@ -28,8 +28,10 @@ namespace OCA\FederatedFileSharing\Tests\Settings;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\FederatedFileSharing\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\AppFramework\Services\IInitialState;
use OCP\GlobalScale\IConfig;
use OCP\IL10N;
+use OCP\IURLGenerator;
use Test\TestCase;
class AdminTest extends TestCase {
@@ -37,17 +39,25 @@ class AdminTest extends TestCase {
private $admin;
/** @var \OCA\FederatedFileSharing\FederatedShareProvider */
private $federatedShareProvider;
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $gsConfig;
protected function setUp(): void {
parent::setUp();
$this->federatedShareProvider = $this->createMock(FederatedShareProvider::class);
$this->gsConfig = $this->createMock(IConfig::class);
+ $this->initialState = $this->createMock(IInitialState::class);
+ $urlGenerator = $this->createMock(IURLGenerator::class);
+ $urlGenerator->expects($this->any())
+ ->method('linkToDocs')
+ ->willReturn('doc-link');
+
$this->admin = new Admin(
$this->federatedShareProvider,
$this->gsConfig,
- $this->createMock(IL10N::class)
+ $this->createMock(IL10N::class),
+ $urlGenerator,
+ $this->initialState
);
}
@@ -102,17 +112,21 @@ class AdminTest extends TestCase {
$this->gsConfig->expects($this->once())->method('onlyInternalFederation')
->willReturn($state);
- $params = [
- 'internalOnly' => $state,
- 'outgoingServer2serverShareEnabled' => $state,
- 'incomingServer2serverShareEnabled' => $state,
- 'lookupServerEnabled' => $state,
- 'lookupServerUploadEnabled' => $state,
- 'federatedGroupSharingSupported' => $state,
- 'outgoingServer2serverGroupShareEnabled' => $state,
- 'incomingServer2serverGroupShareEnabled' => $state,
- ];
- $expected = new TemplateResponse('federatedfilesharing', 'settings-admin', $params, '');
+ $this->initialState->expects($this->exactly(9))
+ ->method('provideInitialState')
+ ->withConsecutive(
+ ['internalOnly', $state],
+ ['sharingFederatedDocUrl', 'doc-link'],
+ ['outgoingServer2serverShareEnabled', $state],
+ ['incomingServer2serverShareEnabled', $state],
+ ['federatedGroupSharingSupported', $state],
+ ['outgoingServer2serverGroupShareEnabled', $state],
+ ['incomingServer2serverGroupShareEnabled', $state],
+ ['lookupServerEnabled', $state],
+ ['lookupServerUploadEnabled', $state],
+ );
+
+ $expected = new TemplateResponse('federatedfilesharing', 'settings-admin', [], '');
$this->assertEquals($expected, $this->admin->getForm());
}