summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
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([