From bc1efdf2e1c0744748e03b1552a9b8234e509d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 24 Apr 2017 10:50:24 +0200 Subject: [PATCH] Fix theming tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/theming/lib/ThemingDefaults.php | 2 +- apps/theming/tests/ThemingDefaultsTest.php | 41 +++++++--------------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index e73887d6162..319474a8552 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -169,7 +169,7 @@ class ThemingDefaults extends \OC_Defaults { return $this->urlGenerator->imagePath('core','background.jpg'); } - return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground'); + return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground'); } diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index dfa226c403d..2fda63d4fe1 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -421,26 +421,17 @@ class ThemingDefaultsTest extends TestCase { public function testGetBackgroundCustom() { $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); - $folder->expects($this->once())->method('getFile')->willReturn($file); + $folder->expects($this->once()) + ->method('getFile') + ->willReturn($file); $this->appData->expects($this->once()) ->method('getFolder') ->willReturn($folder); $this->config ->expects($this->once()) ->method('getAppValue') - ->with('theming', 'backgroundMime') + ->with('theming', 'backgroundMime', false) ->willReturn('image/svg+xml'); - $simpleFolder = $this->createMock(ISimpleFolder::class); - $this->appData - ->expects($this->once()) - ->method('getFolder') - ->with('images') - ->willReturn($simpleFolder); - $simpleFolder - ->expects($this->once()) - ->method('getFile') - ->with('background') - ->willReturn(''); $expected = $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground'); $this->assertEquals($expected, $this->template->getBackground()); } @@ -471,31 +462,22 @@ class ThemingDefaultsTest extends TestCase { public function testGetLogoCustom() { $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); - $folder->expects($this->once())->method('getFile')->willReturn($file); + $folder->expects($this->once()) + ->method('getFile') + ->willReturn($file); $this->appData->expects($this->once()) ->method('getFolder') ->willReturn($folder); $this->config ->expects($this->at(0)) ->method('getAppValue') - ->with('theming', 'logoMime') + ->with('theming', 'logoMime', false) ->willReturn('image/svg+xml'); $this->config ->expects($this->at(1)) ->method('getAppValue') ->with('theming', 'cachebuster', '0') ->willReturn('0'); - $simpleFolder = $this->createMock(ISimpleFolder::class); - $this->appData - ->expects($this->once()) - ->method('getFolder') - ->with('images') - ->willReturn($simpleFolder); - $simpleFolder - ->expects($this->once()) - ->method('getFile') - ->with('logo') - ->willReturn(''); $expected = $this->urlGenerator->getAbsoluteURL('index.php/apps/theming/logo') . '?v=0'; $this->assertEquals($expected, $this->template->getLogo()); } @@ -508,10 +490,11 @@ class ThemingDefaultsTest extends TestCase { public function testGetScssVariables() { $this->config->expects($this->at(0))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0'); $this->config->expects($this->at(1))->method('getAppValue')->with('theming', 'logoMime', false)->willReturn('jpeg'); - $this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg'); - $this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'color', null)->willReturn('#000000'); - $this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'color', '#000')->willReturn('#000000'); + $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('#000000'); $this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'color', '#000')->willReturn('#000000'); + $this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'color', '#000')->willReturn('#000000'); $this->util->expects($this->any())->method('invertTextColor')->with('#000000')->willReturn(false); $this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(null);