Skip to content

Commit e456794

Browse files
committed
test(settings): add tests for developer documentation link generation
Signed-off-by: Arsalan Ul Haq Sohni <[email protected]>
1 parent 1829269 commit e456794

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

apps/settings/tests/Controller/AppSettingsControllerTest.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,21 @@ public function testViewApps(): void {
169169
->method('setActiveEntry')
170170
->with('core_apps');
171171

172+
// Test that developer docs link is generated correctly
173+
$this->urlGenerator
174+
->expects($this->once())
175+
->method('linkToDocs')
176+
->with('developer-manual')
177+
->willReturn('https://docs.nextcloud.com/server/latest/developer_manual/');
178+
172179
$this->initialState
173180
->expects($this->exactly(4))
174-
->method('provideInitialState');
181+
->method('provideInitialState')
182+
->willReturnCallback(function ($key, $value) {
183+
if ($key === 'appstoreDeveloperDocs') {
184+
$this->assertEquals('https://docs.nextcloud.com/server/latest/developer_manual/', $value);
185+
}
186+
});
175187

176188
$policy = new ContentSecurityPolicy();
177189
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
@@ -202,9 +214,21 @@ public function testViewAppsAppstoreNotEnabled(): void {
202214
->method('setActiveEntry')
203215
->with('core_apps');
204216

217+
// Test that developer docs link is still generated even when appstore is disabled
218+
$this->urlGenerator
219+
->expects($this->once())
220+
->method('linkToDocs')
221+
->with('developer-manual')
222+
->willReturn('https://docs.nextcloud.com/server/latest/developer_manual/');
223+
205224
$this->initialState
206225
->expects($this->exactly(4))
207-
->method('provideInitialState');
226+
->method('provideInitialState')
227+
->willReturnCallback(function ($key, $value) {
228+
if ($key === 'appstoreDeveloperDocs') {
229+
$this->assertEquals('https://docs.nextcloud.com/server/latest/developer_manual/', $value);
230+
}
231+
});
208232

209233
$policy = new ContentSecurityPolicy();
210234
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');

0 commit comments

Comments
 (0)