summaryrefslogtreecommitdiffstats
path: root/apps/theming/tests
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-04-30 12:31:09 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2022-04-30 13:40:27 +0200
commitf577b5dc96bf6248a1d0c5497573dd3b3eaaffd9 (patch)
treec06361089caa9faebbd8890233df8e2bed98d8d6 /apps/theming/tests
parent24c5d994c7652f266f62563f11bab55defc41dae (diff)
downloadnextcloud-server-f577b5dc96bf6248a1d0c5497573dd3b3eaaffd9.tar.gz
nextcloud-server-f577b5dc96bf6248a1d0c5497573dd3b3eaaffd9.zip
Fix theming setEnabledThemes unique array
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/theming/tests')
-rw-r--r--apps/theming/tests/Service/ThemesServiceTest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php
index 657418db471..90816ae2328 100644
--- a/apps/theming/tests/Service/ThemesServiceTest.php
+++ b/apps/theming/tests/Service/ThemesServiceTest.php
@@ -239,6 +239,38 @@ class ThemesServiceTest extends TestCase {
$this->assertEquals(['light'], $this->themesService->getEnabledThemes());
}
+
+ public function dataTestSetEnabledThemes() {
+ return [
+ [[], []],
+ [['light'], ['light']],
+ [['dark'], ['dark']],
+ [['dark', 'dark', 'opendyslexic'], ['dark', 'opendyslexic']],
+ ];
+ }
+
+ /**
+ * @dataProvider dataTestSetEnabledThemes
+ *
+ * @param string[] $enabledThemes
+ * @param string[] $expected
+ */
+ public function testSetEnabledThemes(array $enabledThemes, array $expected) {
+ $user = $this->createMock(IUser::class);
+ $this->userSession->expects($this->any())
+ ->method('getUser')
+ ->willReturn($user);
+ $user->expects($this->any())
+ ->method('getUID')
+ ->willReturn('user');
+
+ $this->config->expects($this->once())
+ ->method('setUserValue')
+ ->with('user', Application::APP_ID, 'enabled-themes', json_encode($expected));
+
+ $this->invokePrivate($this->themesService, 'setEnabledThemes', [$enabledThemes]);
+ }
+
private function initThemes() {
$util = $this->createMock(Util::class);
$urlGenerator = $this->createMock(IURLGenerator::class);