mirror of
https://github.com/nextcloud/server.git
synced 2026-02-17 09:51:38 -05:00
Fix tests
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
40e2b11a68
commit
3c6da41c8a
7 changed files with 54 additions and 12 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, '');
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in a new issue