diff options
Diffstat (limited to 'apps/theming/tests/ThemingDefaultsTest.php')
-rw-r--r-- | apps/theming/tests/ThemingDefaultsTest.php | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 736eeb3afc3..a7cb7790aa6 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -384,10 +384,15 @@ class ThemingDefaultsTest extends TestCase { ->method('getFolder') ->willThrowException(new NotFoundException()); $this->config - ->expects($this->once()) + ->expects($this->at(0)) ->method('getAppValue') ->with('theming', 'backgroundMime') ->willReturn(''); + $this->config + ->expects($this->at(1)) + ->method('getAppValue') + ->with('theming', 'cachebuster', '0') + ->willReturn('0'); $this->appData ->expects($this->once()) ->method('getFolder') @@ -397,7 +402,7 @@ class ThemingDefaultsTest extends TestCase { ->method('imagePath') ->with('core', 'background.jpg') ->willReturn('core-background'); - $this->assertEquals('core-background', $this->template->getBackground()); + $this->assertEquals('core-background?v=0', $this->template->getBackground()); } public function testGetBackgroundCustom() { @@ -410,18 +415,23 @@ class ThemingDefaultsTest extends TestCase { ->method('getFolder') ->willReturn($folder); $this->config - ->expects($this->once()) + ->expects($this->at(0)) ->method('getAppValue') ->with('theming', 'backgroundMime', false) ->willReturn('image/svg+xml'); + $this->config + ->expects($this->at(1)) + ->method('getAppValue') + ->with('theming', 'cachebuster', '0') + ->willReturn('0'); $this->urlGenerator->expects($this->once()) ->method('linkToRoute') ->with('theming.Theming.getLoginBackground') ->willReturn('custom-background'); - $this->assertEquals('custom-background', $this->template->getBackground()); + $this->assertEquals('custom-background?v=0', $this->template->getBackground()); } - public function testGetLogoDefault() { + private function getLogoHelper($withName, $useSvg) { $this->appData->expects($this->once()) ->method('getFolder') ->willThrowException(new NotFoundException()); @@ -442,9 +452,17 @@ class ThemingDefaultsTest extends TestCase { ->willThrowException(new \Exception()); $this->urlGenerator->expects($this->once()) ->method('imagePath') - ->with('core', 'logo.svg') + ->with('core', $withName) ->willReturn('core-logo'); - $this->assertEquals('core-logo' . '?v=0', $this->template->getLogo()); + $this->assertEquals('core-logo?v=0', $this->template->getLogo($useSvg)); + } + + public function testGetLogoDefaultWithSvg() { + $this->getLogoHelper('logo.svg', true); + } + + public function testGetLogoDefaultWithoutSvg() { + $this->getLogoHelper('logo.png', false); } public function testGetLogoCustom() { @@ -483,9 +501,10 @@ class ThemingDefaultsTest extends TestCase { $this->config->expects($this->at(1))->method('getAppValue')->with('theming', 'logoMime', false)->willReturn('jpeg'); $this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0'); $this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg'); - $this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'color', null)->willReturn($this->defaults->getColorPrimary()); - $this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary()); + $this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0'); + $this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'color', null)->willReturn($this->defaults->getColorPrimary()); $this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary()); + $this->config->expects($this->at(7))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary()); $this->util->expects($this->any())->method('invertTextColor')->with($this->defaults->getColorPrimary())->willReturn(false); $this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(null); @@ -512,9 +531,10 @@ class ThemingDefaultsTest extends TestCase { $expected = [ 'theming-cachebuster' => '\'0\'', 'image-logo' => "'absolute-custom-logo?v=0'", - 'image-login-background' => "'absolute-custom-background'", + 'image-login-background' => "'absolute-custom-background?v=0'", 'color-primary' => $this->defaults->getColorPrimary(), - 'color-primary-text' => '#ffffff' + 'color-primary-text' => '#ffffff', + 'image-login-plain' => 'false' ]; $this->assertEquals($expected, $this->template->getScssVariables()); |