Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-05-22 11:48:51 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-05-23 21:31:40 +0300
commit22ae6828237a516b1cd36a3dad623b8046dfd76a (patch)
treec00361d0747e295f98e1e089114b8bf48bcc0e57 /tests/lib/Settings
parent09974ae92d6f3bc20143dab43baef9fc75139585 (diff)
Make it possible to show admin settings for sub admins
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Settings')
-rw-r--r--tests/lib/Settings/ManagerTest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index 7372cae811b..4128e33aef1 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -23,6 +23,7 @@
namespace Tests\Settings;
+use function get_class;
use OC\Settings\Admin\Sharing;
use OC\Settings\Manager;
use OC\Settings\Mapper;
@@ -34,6 +35,8 @@ use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
+use OCP\Settings\ISettings;
+use OCP\Settings\ISubAdminSettings;
use Test\TestCase;
class ManagerTest extends TestCase {
@@ -207,6 +210,35 @@ class ManagerTest extends TestCase {
], $settings);
}
+ public function testGetAdminSettingsAsSubAdmin() {
+ $section = $this->createMock(Sharing::class);
+ $this->container->expects($this->once())
+ ->method('query')
+ ->with(Sharing::class)
+ ->willReturn($section);
+
+ $settings = $this->manager->getAdminSettings('sharing', true);
+
+ $this->assertEquals([], $settings);
+ }
+
+ public function testGetSubAdminSettingsAsSubAdmin() {
+ $section = $this->createMock(ISubAdminSettings::class);
+ $section->expects($this->once())
+ ->method('getPriority')
+ ->willReturn(13);
+ $this->container->expects($this->once())
+ ->method('query')
+ ->with(Sharing::class)
+ ->willReturn($section);
+
+ $settings = $this->manager->getAdminSettings('sharing', true);
+
+ $this->assertEquals([
+ 13 => [$section]
+ ], $settings);
+ }
+
public function testGetPersonalSettings() {
$section = $this->createMock(Security::class);
$section->expects($this->once())