summaryrefslogtreecommitdiffstats
path: root/apps/theming
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-10-19 12:22:54 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2022-10-19 12:57:35 +0200
commit746710ad5b55127826bb52d5c9923002ea443b0a (patch)
tree52512cc33969beb89381471f5836abbcaa88b1a8 /apps/theming
parentef760e0337018c8a45bb380d1a1d50f912ca23ee (diff)
downloadnextcloud-server-746710ad5b55127826bb52d5c9923002ea443b0a.tar.gz
nextcloud-server-746710ad5b55127826bb52d5c9923002ea443b0a.zip
Fix tests
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/theming')
-rw-r--r--apps/theming/css/default.css5
-rw-r--r--apps/theming/tests/Service/ThemesServiceTest.php11
-rw-r--r--apps/theming/tests/Settings/AdminTest.php2
-rw-r--r--apps/theming/tests/Settings/PersonalTest.php16
-rw-r--r--apps/theming/tests/Themes/DefaultThemeTest.php7
-rw-r--r--apps/theming/tests/Themes/DyslexiaFontTest.php5
-rw-r--r--apps/theming/tests/ThemingDefaultsTest.php20
7 files changed, 54 insertions, 12 deletions
diff --git a/apps/theming/css/default.css b/apps/theming/css/default.css
index 226f7ccc43f..666d2781ee2 100644
--- a/apps/theming/css/default.css
+++ b/apps/theming/css/default.css
@@ -51,10 +51,11 @@
--header-menu-item-height: 44px;
--header-menu-profile-item-height: 66px;
--breakpoint-mobile: 1024px;
- --primary-invert-if-bright: no;
--background-invert-if-dark: no;
--background-invert-if-bright: invert(100%);
- --image-main-background: url('/core/img/app-background.jpg');
+ --image-background: url('/core/img/app-background.jpg');
+ --color-background-plain: #0082c9;
+ --primary-invert-if-bright: no;
--color-primary: #00639a;
--color-primary-default: #0082c9;
--color-primary-text: #ffffff;
diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php
index 62f00ab0e31..ba970b92394 100644
--- a/apps/theming/tests/Service/ThemesServiceTest.php
+++ b/apps/theming/tests/Service/ThemesServiceTest.php
@@ -34,11 +34,9 @@ use OCA\Theming\Service\ThemesService;
use OCA\Theming\Themes\LightTheme;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
-use OCP\AppFramework\Http\DataResponse;
-use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\IConfig;
use OCP\IL10N;
-use OCP\IRequest;
+use OCP\App\IAppManager;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
@@ -280,6 +278,7 @@ class ThemesServiceTest extends TestCase {
$urlGenerator = $this->createMock(IURLGenerator::class);
$imageManager = $this->createMock(ImageManager::class);
$l10n = $this->createMock(IL10N::class);
+ $appManager = $this->createMock(IAppManager::class);
$this->themes = [
'default' => new DefaultTheme(
@@ -290,6 +289,7 @@ class ThemesServiceTest extends TestCase {
$imageManager,
$this->config,
$l10n,
+ $appManager,
),
'light' => new LightTheme(
$util,
@@ -299,6 +299,7 @@ class ThemesServiceTest extends TestCase {
$imageManager,
$this->config,
$l10n,
+ $appManager,
),
'dark' => new DarkTheme(
$util,
@@ -308,6 +309,7 @@ class ThemesServiceTest extends TestCase {
$imageManager,
$this->config,
$l10n,
+ $appManager,
),
'light-highcontrast' => new HighContrastTheme(
$util,
@@ -317,6 +319,7 @@ class ThemesServiceTest extends TestCase {
$imageManager,
$this->config,
$l10n,
+ $appManager,
),
'dark-highcontrast' => new DarkHighContrastTheme(
$util,
@@ -326,6 +329,7 @@ class ThemesServiceTest extends TestCase {
$imageManager,
$this->config,
$l10n,
+ $appManager,
),
'opendyslexic' => new DyslexiaFont(
$util,
@@ -335,6 +339,7 @@ class ThemesServiceTest extends TestCase {
$imageManager,
$this->config,
$l10n,
+ $appManager,
),
];
}
diff --git a/apps/theming/tests/Settings/AdminTest.php b/apps/theming/tests/Settings/AdminTest.php
index 8f259e29ba5..df884f4f803 100644
--- a/apps/theming/tests/Settings/AdminTest.php
+++ b/apps/theming/tests/Settings/AdminTest.php
@@ -117,6 +117,7 @@ class AdminTest extends TestCase {
'images' => [],
'imprintUrl' => '',
'privacyUrl' => '',
+ 'userThemingDisabled' => false,
];
$expected = new TemplateResponse('theming', 'settings-admin', $params, '');
@@ -176,6 +177,7 @@ class AdminTest extends TestCase {
'images' => [],
'imprintUrl' => '',
'privacyUrl' => '',
+ 'userThemingDisabled' => false
];
$expected = new TemplateResponse('theming', 'settings-admin', $params, '');
diff --git a/apps/theming/tests/Settings/PersonalTest.php b/apps/theming/tests/Settings/PersonalTest.php
index 8597461a175..f8f6052a0f8 100644
--- a/apps/theming/tests/Settings/PersonalTest.php
+++ b/apps/theming/tests/Settings/PersonalTest.php
@@ -40,6 +40,7 @@ use OCA\Theming\Themes\LightTheme;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
use OCA\Theming\ITheme;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
@@ -52,6 +53,7 @@ class PersonalTest extends TestCase {
private IConfig $config;
private ThemesService $themesService;
private IInitialState $initialStateService;
+ private ThemingDefaults $themingDefaults;
/** @var ITheme[] */
private $themes;
@@ -61,6 +63,7 @@ class PersonalTest extends TestCase {
$this->config = $this->createMock(IConfig::class);
$this->themesService = $this->createMock(ThemesService::class);
$this->initialStateService = $this->createMock(IInitialState::class);
+ $this->themingDefaults = $this->createMock(ThemingDefaults::class);
$this->initThemes();
@@ -73,7 +76,8 @@ class PersonalTest extends TestCase {
Application::APP_ID,
$this->config,
$this->themesService,
- $this->initialStateService
+ $this->initialStateService,
+ $this->themingDefaults,
);
}
@@ -107,11 +111,12 @@ class PersonalTest extends TestCase {
->with('enforce_theme', '')
->willReturn($enforcedTheme);
- $this->initialStateService->expects($this->exactly(2))
+ $this->initialStateService->expects($this->exactly(3))
->method('provideInitialState')
->withConsecutive(
['themes', $themesState],
['enforceTheme', $enforcedTheme],
+ ['isUserThemingDisabled', false]
);
$expected = new TemplateResponse('theming', 'settings-personal');
@@ -134,6 +139,7 @@ class PersonalTest extends TestCase {
$imageManager = $this->createMock(ImageManager::class);
$config = $this->createMock(IConfig::class);
$l10n = $this->createMock(IL10N::class);
+ $appManager = $this->createMock(IAppManager::class);
$themingDefaults->expects($this->any())
->method('getColorPrimary')
@@ -152,6 +158,7 @@ class PersonalTest extends TestCase {
$imageManager,
$config,
$l10n,
+ $appManager,
),
'light' => new LightTheme(
$util,
@@ -161,6 +168,7 @@ class PersonalTest extends TestCase {
$imageManager,
$config,
$l10n,
+ $appManager,
),
'dark' => new DarkTheme(
$util,
@@ -170,6 +178,7 @@ class PersonalTest extends TestCase {
$imageManager,
$config,
$l10n,
+ $appManager,
),
'light-highcontrast' => new HighContrastTheme(
$util,
@@ -179,6 +188,7 @@ class PersonalTest extends TestCase {
$imageManager,
$config,
$l10n,
+ $appManager,
),
'dark-highcontrast' => new DarkHighContrastTheme(
$util,
@@ -188,6 +198,7 @@ class PersonalTest extends TestCase {
$imageManager,
$config,
$l10n,
+ $appManager,
),
'opendyslexic' => new DyslexiaFont(
$util,
@@ -197,6 +208,7 @@ class PersonalTest extends TestCase {
$imageManager,
$config,
$l10n,
+ $appManager,
),
];
}
diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php
index eafd66ef663..eb9f41d378f 100644
--- a/apps/theming/tests/Themes/DefaultThemeTest.php
+++ b/apps/theming/tests/Themes/DefaultThemeTest.php
@@ -28,6 +28,7 @@ use OCA\Theming\ITheme;
use OCA\Theming\Themes\DefaultTheme;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
+use OCP\App\IAppManager;
use OCP\Files\IAppData;
use OCP\IConfig;
use OCP\IL10N;
@@ -48,6 +49,8 @@ class DefaultThemeTest extends TestCase {
private $config;
/** @var IL10N|MockObject */
private $l10n;
+ /** @var IAppManager|MockObject */
+ private $appManager;
private DefaultTheme $defaultTheme;
@@ -58,10 +61,11 @@ class DefaultThemeTest extends TestCase {
$this->imageManager = $this->createMock(ImageManager::class);
$this->config = $this->createMock(IConfig::class);
$this->l10n = $this->createMock(IL10N::class);
+ $this->appManager = $this->createMock(IAppManager::class);
$util = new Util(
$this->config,
- $this->createMock(AppManager::class),
+ $this->appManager,
$this->createMock(IAppData::class)
);
@@ -97,6 +101,7 @@ class DefaultThemeTest extends TestCase {
$this->imageManager,
$this->config,
$this->l10n,
+ $this->appManager,
);
parent::setUp();
diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php
index 8a0df960205..1a0f0adebec 100644
--- a/apps/theming/tests/Themes/DyslexiaFontTest.php
+++ b/apps/theming/tests/Themes/DyslexiaFontTest.php
@@ -29,6 +29,7 @@ use OCA\Theming\ITheme;
use OCA\Theming\Themes\DyslexiaFont;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
+use OCP\App\IAppManager;
use OCP\Files\IAppData;
use OCP\ICacheFactory;
use OCP\IConfig;
@@ -51,6 +52,8 @@ class DyslexiaFontTest extends TestCase {
private $config;
/** @var IL10N|MockObject */
private $l10n;
+ /** @var IAppManager|MockObject */
+ private $appManager;
private DyslexiaFont $dyslexiaFont;
@@ -60,6 +63,7 @@ class DyslexiaFontTest extends TestCase {
$this->imageManager = $this->createMock(ImageManager::class);
$this->config = $this->createMock(IConfig::class);
$this->l10n = $this->createMock(IL10N::class);
+ $this->appManager = $this->createMock(IAppManager::class);
$util = new Util(
$this->config,
@@ -104,6 +108,7 @@ class DyslexiaFontTest extends TestCase {
$this->imageManager,
$this->config,
$this->l10n,
+ $this->appManager,
);
parent::setUp();
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index 5106b2551b8..d8940670137 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -424,20 +424,30 @@ class ThemingDefaultsTest extends TestCase {
public function testGetColorPrimaryWithDefault() {
$this->config
- ->expects($this->once())
+ ->expects($this->at(0))
->method('getAppValue')
->with('theming', 'color', null)
->willReturn($this->defaults->getColorPrimary());
+ $this->config
+ ->expects($this->at(1))
+ ->method('getAppValue')
+ ->with('theming', 'disable-user-theming', 'no')
+ ->willReturn('no');
$this->assertEquals($this->defaults->getColorPrimary(), $this->template->getColorPrimary());
}
- public function testgetColorPrimaryWithCustom() {
+ public function testGetColorPrimaryWithCustom() {
$this->config
- ->expects($this->once())
+ ->expects($this->at(0))
->method('getAppValue')
->with('theming', 'color', null)
->willReturn('#fff');
+ $this->config
+ ->expects($this->at(1))
+ ->method('getAppValue')
+ ->with('theming', 'disable-user-theming', 'no')
+ ->willReturn('no');
$this->assertEquals('#fff', $this->template->getColorPrimary());
}
@@ -613,14 +623,16 @@ class ThemingDefaultsTest extends TestCase {
->method('deleteAppValue')
->with('theming', 'color');
$this->config
- ->expects($this->exactly(2))
+ ->expects($this->exactly(3))
->method('getAppValue')
->withConsecutive(
['theming', 'cachebuster', '0'],
['theming', 'color', null],
+ ['theming', 'disable-user-theming', 'no'],
)->willReturnOnConsecutiveCalls(
'15',
$this->defaults->getColorPrimary(),
+ 'no',
);
$this->config
->expects($this->once())