diff options
Diffstat (limited to 'apps/federatedfilesharing/tests/Settings/AdminTest.php')
-rw-r--r-- | apps/federatedfilesharing/tests/Settings/AdminTest.php | 40 |
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()); } |