Skip to content

Commit 4e4cd89

Browse files
committed
Fix theming tests
Signed-off-by: Julius Härtl <[email protected]>
1 parent a329596 commit 4e4cd89

File tree

2 files changed

+13
-30
lines changed

2 files changed

+13
-30
lines changed

apps/theming/lib/ThemingDefaults.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function getBackground() {
169169
return $this->urlGenerator->imagePath('core','background.jpg');
170170
}
171171

172-
return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground');
172+
return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground');
173173
}
174174

175175

apps/theming/tests/ThemingDefaultsTest.php

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -421,26 +421,17 @@ public function testGetBackgroundDefault() {
421421
public function testGetBackgroundCustom() {
422422
$folder = $this->createMock(ISimpleFolder::class);
423423
$file = $this->createMock(ISimpleFile::class);
424-
$folder->expects($this->once())->method('getFile')->willReturn($file);
424+
$folder->expects($this->once())
425+
->method('getFile')
426+
->willReturn($file);
425427
$this->appData->expects($this->once())
426428
->method('getFolder')
427429
->willReturn($folder);
428430
$this->config
429431
->expects($this->once())
430432
->method('getAppValue')
431-
->with('theming', 'backgroundMime')
433+
->with('theming', 'backgroundMime', false)
432434
->willReturn('image/svg+xml');
433-
$simpleFolder = $this->createMock(ISimpleFolder::class);
434-
$this->appData
435-
->expects($this->once())
436-
->method('getFolder')
437-
->with('images')
438-
->willReturn($simpleFolder);
439-
$simpleFolder
440-
->expects($this->once())
441-
->method('getFile')
442-
->with('background')
443-
->willReturn('');
444435
$expected = $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground');
445436
$this->assertEquals($expected, $this->template->getBackground());
446437
}
@@ -471,31 +462,22 @@ public function testGetLogoDefault() {
471462
public function testGetLogoCustom() {
472463
$folder = $this->createMock(ISimpleFolder::class);
473464
$file = $this->createMock(ISimpleFile::class);
474-
$folder->expects($this->once())->method('getFile')->willReturn($file);
465+
$folder->expects($this->once())
466+
->method('getFile')
467+
->willReturn($file);
475468
$this->appData->expects($this->once())
476469
->method('getFolder')
477470
->willReturn($folder);
478471
$this->config
479472
->expects($this->at(0))
480473
->method('getAppValue')
481-
->with('theming', 'logoMime')
474+
->with('theming', 'logoMime', false)
482475
->willReturn('image/svg+xml');
483476
$this->config
484477
->expects($this->at(1))
485478
->method('getAppValue')
486479
->with('theming', 'cachebuster', '0')
487480
->willReturn('0');
488-
$simpleFolder = $this->createMock(ISimpleFolder::class);
489-
$this->appData
490-
->expects($this->once())
491-
->method('getFolder')
492-
->with('images')
493-
->willReturn($simpleFolder);
494-
$simpleFolder
495-
->expects($this->once())
496-
->method('getFile')
497-
->with('logo')
498-
->willReturn('');
499481
$expected = $this->urlGenerator->getAbsoluteURL('index.php/apps/theming/logo') . '?v=0';
500482
$this->assertEquals($expected, $this->template->getLogo());
501483
}
@@ -508,10 +490,11 @@ public function testGetScssVariablesCached() {
508490
public function testGetScssVariables() {
509491
$this->config->expects($this->at(0))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0');
510492
$this->config->expects($this->at(1))->method('getAppValue')->with('theming', 'logoMime', false)->willReturn('jpeg');
511-
$this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg');
512-
$this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'color', null)->willReturn('#000000');
513-
$this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'color', '#000')->willReturn('#000000');
493+
$this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0');
494+
$this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg');
495+
$this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'color', null)->willReturn('#000000');
514496
$this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'color', '#000')->willReturn('#000000');
497+
$this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'color', '#000')->willReturn('#000000');
515498

516499
$this->util->expects($this->any())->method('invertTextColor')->with('#000000')->willReturn(false);
517500
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(null);

0 commit comments

Comments
 (0)