aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/tests
diff options
context:
space:
mode:
authorjld3103 <jld3103yt@gmail.com>2023-12-07 16:39:16 +0100
committerAndrey Borysenko <andrey18106x@gmail.com>2024-03-12 13:56:54 +0200
commit4ac2375ca2082750432ccc9cff46bf5888b4db30 (patch)
treebca24a21f4dfa0184f8e400e9508fc5600ade8d4 /apps/settings/tests
parentc42397358f05aa60ae91ed11e7754fddba182cce (diff)
downloadnextcloud-server-4ac2375ca2082750432ccc9cff46bf5888b4db30.tar.gz
nextcloud-server-4ac2375ca2082750432ccc9cff46bf5888b4db30.zip
feat: Add declarative settings
Signed-off-by: jld3103 <jld3103yt@gmail.com> Signed-off-by: Julien Veyssier <julien-nc@posteo.net> Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Diffstat (limited to 'apps/settings/tests')
-rw-r--r--apps/settings/tests/Controller/AdminSettingsControllerTest.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/settings/tests/Controller/AdminSettingsControllerTest.php b/apps/settings/tests/Controller/AdminSettingsControllerTest.php
index acdcaa136aa..6a11ceb9fca 100644
--- a/apps/settings/tests/Controller/AdminSettingsControllerTest.php
+++ b/apps/settings/tests/Controller/AdminSettingsControllerTest.php
@@ -29,12 +29,14 @@ namespace OCA\Settings\Tests\Controller;
use OCA\Settings\Controller\AdminSettingsController;
use OCA\Settings\Settings\Personal\ServerDevNotice;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\AppFramework\Services\IInitialState;
use OCP\Group\ISubAdmin;
use OCP\IGroupManager;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
+use OCP\Settings\IDeclarativeManager;
use OCP\Settings\IManager;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -62,6 +64,10 @@ class AdminSettingsControllerTest extends TestCase {
private $groupManager;
/** @var ISubAdmin|MockObject */
private $subAdmin;
+ /** @var IDeclarativeManager|MockObject */
+ private $declarativeSettingsManager;
+ /** @var IInitialState|MockObject */
+ private $initialState;
/** @var string */
private $adminUid = 'lololo';
@@ -74,6 +80,8 @@ class AdminSettingsControllerTest extends TestCase {
$this->userSession = $this->createMock(IUserSession::class);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->subAdmin = $this->createMock(ISubAdmin::class);
+ $this->declarativeSettingsManager = $this->createMock(IDeclarativeManager::class);
+ $this->initialState = $this->createMock(IInitialState::class);
$this->adminSettingsController = new AdminSettingsController(
'settings',
@@ -82,7 +90,9 @@ class AdminSettingsControllerTest extends TestCase {
$this->settingsManager,
$this->userSession,
$this->groupManager,
- $this->subAdmin
+ $this->subAdmin,
+ $this->declarativeSettingsManager,
+ $this->initialState,
);
$user = \OC::$server->getUserManager()->createUser($this->adminUid, 'mylongrandompassword');
@@ -123,6 +133,11 @@ class AdminSettingsControllerTest extends TestCase {
->method('getAllowedAdminSettings')
->with('test')
->willReturn([5 => $this->createMock(ServerDevNotice::class)]);
+ $this->declarativeSettingsManager
+ ->expects($this->any())
+ ->method('getFormIDs')
+ ->with($user, 'admin', 'test')
+ ->willReturn([]);
$idx = $this->adminSettingsController->index('test');