summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-01-31 16:55:17 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-01-31 16:55:17 +0100
commitbfaf3fff33b663dd3e90f825445d1c95c98ea724 (patch)
tree5c25cb51be7e7fdbae01ef8a857654f724ea4695 /tests
parent78c7e6f2c5609122d047a36fc44390b42a341566 (diff)
downloadnextcloud-server-bfaf3fff33b663dd3e90f825445d1c95c98ea724.tar.gz
nextcloud-server-bfaf3fff33b663dd3e90f825445d1c95c98ea724.zip
Move Admin Settings also to info.xml
More cleanup of the Settings apps. Makes the manager cleaner and a proper manager. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Settings/ManagerTest.php33
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index 06eafb6528b..bce547c9a29 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -102,15 +102,16 @@ class ManagerTest extends TestCase {
}
public function testGetAdminSettings() {
- $section = $this->createMock(Sharing::class);
- $section->expects($this->once())
- ->method('getPriority')
+ $section = $this->createMock(ISettings::class);
+ $section->method('getPriority')
->willReturn(13);
- $this->container->expects($this->once())
- ->method('query')
- ->with(Sharing::class)
+ $section->method('getSection')
+ ->willReturn('sharing');
+ $this->container->method('query')
+ ->with('myAdminClass')
->willReturn($section);
+ $this->manager->registerSetting('admin', 'myAdminClass');
$settings = $this->manager->getAdminSettings('sharing');
$this->assertEquals([
@@ -119,12 +120,16 @@ class ManagerTest extends TestCase {
}
public function testGetAdminSettingsAsSubAdmin() {
- $section = $this->createMock(Sharing::class);
- $this->container->expects($this->once())
- ->method('query')
- ->with(Sharing::class)
+ $section = $this->createMock(ISettings::class);
+ $section->method('getPriority')
+ ->willReturn(13);
+ $section->method('getSection')
+ ->willReturn('sharing');
+ $this->container->method('query')
+ ->with('myAdminClass')
->willReturn($section);
+ $this->manager->registerSetting('admin', 'myAdminClass');
$settings = $this->manager->getAdminSettings('sharing', true);
$this->assertEquals([], $settings);
@@ -132,14 +137,16 @@ class ManagerTest extends TestCase {
public function testGetSubAdminSettingsAsSubAdmin() {
$section = $this->createMock(ISubAdminSettings::class);
- $section->expects($this->once())
- ->method('getPriority')
+ $section->method('getPriority')
->willReturn(13);
+ $section->method('getSection')
+ ->willReturn('sharing');
$this->container->expects($this->once())
->method('query')
- ->with(Sharing::class)
+ ->with('mySubAdminClass')
->willReturn($section);
+ $this->manager->registerSetting('admin', 'mySubAdminClass');
$settings = $this->manager->getAdminSettings('sharing', true);
$this->assertEquals([